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


Python PatternGraph._parse_text方法代码示例

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


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

示例1: test_parse_text_oneormore

# 需要导入模块: from programy.parser.pattern.graph import PatternGraph [as 别名]
# 或者: from programy.parser.pattern.graph.PatternGraph import _parse_text [as 别名]
    def test_parse_text_oneormore(self):
        graph = PatternGraph()
        root = PatternRootNode()
        final_node = graph._parse_text("_", root)
        self.assertIsNotNone(final_node)
        self.assertIsInstance(final_node, PatternOneOrMoreWildCardNode)

        final_node = graph._parse_text("*", root)
        self.assertIsNotNone(final_node)
        self.assertIsInstance(final_node, PatternOneOrMoreWildCardNode)
开发者ID:Doshmaku,项目名称:program-y,代码行数:12,代码来源:test_graph.py

示例2: test_parse_text_zeroormore

# 需要导入模块: from programy.parser.pattern.graph import PatternGraph [as 别名]
# 或者: from programy.parser.pattern.graph.PatternGraph import _parse_text [as 别名]
    def test_parse_text_zeroormore(self):
        graph = PatternGraph(self._client_context.brain.aiml_parser)
        root = PatternRootNode()
        final_node = graph._parse_text("^", root)
        self.assertIsNotNone(final_node)
        self.assertIsInstance(final_node, PatternZeroOrMoreWildCardNode)

        final_node = graph._parse_text("#", root)
        self.assertIsNotNone(final_node)
        self.assertIsInstance(final_node, PatternZeroOrMoreWildCardNode)
开发者ID:Freiza,项目名称:program-y,代码行数:12,代码来源:test_graph.py

示例3: test_parse_text_multiple_words

# 需要导入模块: from programy.parser.pattern.graph import PatternGraph [as 别名]
# 或者: from programy.parser.pattern.graph.PatternGraph import _parse_text [as 别名]
 def test_parse_text_multiple_words(self):
     graph = PatternGraph()
     root = PatternRootNode()
     final_node = graph._parse_text("HELLO THERE", root)
     self.assertIsNotNone(final_node)
     self.assertIsInstance(final_node, PatternWordNode)
     self.assertEqual(final_node.word, "THERE")
开发者ID:Doshmaku,项目名称:program-y,代码行数:9,代码来源:test_graph.py

示例4: test_parse_text_nothing

# 需要导入模块: from programy.parser.pattern.graph import PatternGraph [as 别名]
# 或者: from programy.parser.pattern.graph.PatternGraph import _parse_text [as 别名]
 def test_parse_text_nothing(self):
     graph = PatternGraph()
     root = PatternRootNode()
     final_node = graph._parse_text("", root)
     self.assertIsNotNone(final_node)
     self.assertIsInstance(final_node, PatternRootNode)
     self.assertEqual(final_node, root)
开发者ID:Doshmaku,项目名称:program-y,代码行数:9,代码来源:test_graph.py

示例5: test_parse_text_multiple_words_whitespaces

# 需要导入模块: from programy.parser.pattern.graph import PatternGraph [as 别名]
# 或者: from programy.parser.pattern.graph.PatternGraph import _parse_text [as 别名]
 def test_parse_text_multiple_words_whitespaces(self):
     graph = PatternGraph(self._client_context.brain.aiml_parser)
     root = PatternRootNode()
     final_node = graph._parse_text("HELLO \t\n\r THERE", root)
     self.assertIsNotNone(final_node)
     self.assertIsInstance(final_node, PatternWordNode)
     self.assertEqual(final_node.word, "THERE")
开发者ID:Freiza,项目名称:program-y,代码行数:9,代码来源:test_graph.py

示例6: test_parse_text_word

# 需要导入模块: from programy.parser.pattern.graph import PatternGraph [as 别名]
# 或者: from programy.parser.pattern.graph.PatternGraph import _parse_text [as 别名]
 def test_parse_text_word(self):
     graph = PatternGraph(self._client_context.brain.aiml_parser)
     root = PatternRootNode()
     final_node = graph._parse_text("HELLO", root)
     self.assertIsNotNone(final_node)
     self.assertIsInstance(final_node, PatternWordNode)
     self.assertEqual(final_node.word, "HELLO")
开发者ID:Freiza,项目名称:program-y,代码行数:9,代码来源:test_graph.py

示例7: test_parse_text_priority

# 需要导入模块: from programy.parser.pattern.graph import PatternGraph [as 别名]
# 或者: from programy.parser.pattern.graph.PatternGraph import _parse_text [as 别名]
 def test_parse_text_priority(self):
     graph = PatternGraph()
     root = PatternRootNode()
     final_node = graph._parse_text("$HELLO", root)
     self.assertIsNotNone(final_node)
     self.assertIsInstance(final_node, PatternPriorityWordNode)
开发者ID:Doshmaku,项目名称:program-y,代码行数:8,代码来源:test_graph.py


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