当前位置: 首页>>代码示例>>C#>>正文


C# Trie.getKey方法代码示例

本文整理汇总了C#中Trie.getKey方法的典型用法代码示例。如果您正苦于以下问题:C# Trie.getKey方法的具体用法?C# Trie.getKey怎么用?C# Trie.getKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Trie的用法示例。


在下文中一共展示了Trie.getKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: while_MATCHING_OBJECT_extendWith

        //    Take a single pattern matcher and actually add the next object and node to it
        //    If the pattern object involves @prose, @text, or @pattern then switch to those states.
        //    This is only called while MATCHING_OBJECT.  The @prose, @text, @pattern matching algorithms
        //    do their extensions internally.
        //        private void while_MATCHING_OBJECT_extendWith(ProseObject matchedObject, Trie<ProseObject, List<Phrase>>.Node patternNode)
        private void while_MATCHING_OBJECT_extendWith(PNode node, Trie<ProseObject, List<Phrase>>.Node patternNode)
        {
            //	Depending on the contents of patternNode we may need to change state.
            //	If
            //	If we do change state, then re-match
            ProseObject key = patternNode.getKey();
            if (key == [email protected]) {
                //	Either this node matches directly with a word in the pattern, or it's the first node in
                //	a match of @prose, @text, @pattern.  Either way, it goes in the patternComponentNodes.
                patternComponentNodes.Add(node);
            //				this.currNode = patternNode;
                //this.numObjectsMatched++;
                switchToState_MATCHING_PROSE();
                while_MATCHING_PROSE_extendWith(node, patternNode);
                if (currNode.Value != null && currNode.Value.Count != 0) {
                    becomeMatched(node.next);
                }
            } else if (key == [email protected]) {
                switchToState_MATCHING_TEXT();
            } else if (key == [email protected]) {
                switchToState_MATCHING_PATTERN();
                while_MATCHING_PATTERN_extendWith(node, patternNode);
            }
            //  A text expression masquerading as a string.
            else if (	key == [email protected]
                     && node.value == runtime.Quadquote)
            {
                switchToState_MATCHING_TEXT();
                while_MATCHING_TEXT_extendWith(node, patternNode);
            }
            else {

                //	Either this node matches directly with a word in the pattern, or it's the first node in
                //	a match of @prose, @text, @pattern.  Either way, it goes in the patternComponentNodes.
                patternComponentNodes.Add(node);
                this.currNode = patternNode;
                this.numObjectsMatched++;

                //	If there's something to match at this node, and we're not entering a
                //	fancy matcher state.  Then, having a value at this patternNode is the same
                //	thing as saying, there's a phrase out there that matches US.  So we're a match.
                if (state == MatcherState.MATCHING_OBJECT &&
                    patternNode.Value != null &&
                    patternNode.Value.Count != 0) {

                    //isMatched = true;
                    becomeMatched(node.next);
                }
            }
        }
开发者ID:FizzyP,项目名称:Prose,代码行数:55,代码来源:PatternMatcher.cs


注:本文中的Trie.getKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。