private void incrSuffix(ref GstSuffix active, int wordNum) { int origNodeId, begin, end; origNodeId = active.OriginNode.Id; begin = active.BeginIndex; end = active.EndIndex; if (active.OriginNode.IsRoot()) { active.BeginIndex++; } else { active.OriginNode = active.OriginNode.SuffixNode; } active.Canonicalize(); if (origNodeId != active.OriginNode.Id || begin != active.BeginIndex || end != active.EndIndex) { GstUtil.WriteLine(GstVerbosityLevel.Verbose, String.Format( " incrSuffix: Active suffix changed from {0:s} to {1:s}", GstSuffix.ToSuffixString(origNodeId, begin, end), GstSuffix.ToSuffixString(active.OriginNode.Id, active.BeginIndex, active.EndIndex))); } }
private void extendSuffixes(ref GstSuffix active, int endIndex, int wordNum) { GstNode parentNode; GstNode prevParentNode = null; for ( ; ; incrSuffix(ref active, wordNum)) { parentNode = active.OriginNode; if (extendSuffixByRuleOne(ref active, ref parentNode, endIndex, wordNum) == ExtensionResult.Done) { break; } extendSuffixByRuleTwo(ref active, parentNode, ref prevParentNode, endIndex, wordNum); Debug.Assert(ValidateConsistentEdgeText(this, true)); } setSuffixLink(prevParentNode, parentNode); active.EndIndex++; active.Canonicalize(); }