示例#1
0
            private void incrSuffix(ref StSuffix active)
            {
                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)
                {
                    StUtil.WriteLine(StVerbosityLevel.Verbose, String.Format(
                                         "  incrSuffix: Active suffix changed from {0:s} to {1:s}",
                                         StSuffix.ToSuffixString(origNodeId, begin, end),
                                         StSuffix.ToSuffixString(active.OriginNode.Id, active.BeginIndex, active.EndIndex)));
                }
            }
示例#2
0
            private void extendSuffixes(ref StSuffix active, int endIndex)
            {
                StNode parentNode;
                StNode prevParentNode = null;

                for (   ; ; incrSuffix(ref active))
                {
                    parentNode = active.OriginNode;
                    if (extendSuffixByRuleOne(ref active, ref parentNode, endIndex) == ExtensionResult.Done)
                    {
                        break;
                    }
                    extendSuffixByRuleTwo(ref active, parentNode, ref prevParentNode, endIndex);
                }
                setSuffixLink(prevParentNode, parentNode);
                active.EndIndex++;
                active.Canonicalize();
            }
            private void incrSuffix(ref StSuffix active)
            {
                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)
                {
                    StUtil.WriteLine(StVerbosityLevel.Verbose, String.Format(
                        "  incrSuffix: Active suffix changed from {0:s} to {1:s}",
                        StSuffix.ToSuffixString(origNodeId, begin, end),
                        StSuffix.ToSuffixString(active.OriginNode.Id, active.BeginIndex, active.EndIndex)));
                }
            }
            private void extendSuffixes(ref StSuffix active, int endIndex)
            {
                StNode parentNode;
                StNode prevParentNode = null;

                for (   ; ; incrSuffix(ref active))
                {
                    parentNode = active.OriginNode;
                    if (extendSuffixByRuleOne(ref active, ref parentNode,  endIndex) == ExtensionResult.Done)
                    {
                        break;
                    }
                    extendSuffixByRuleTwo(ref active, parentNode, ref prevParentNode, endIndex);
                }
                setSuffixLink(prevParentNode, parentNode);
                active.EndIndex++;
                active.Canonicalize();
            }