コード例 #1
0
ファイル: test_matcher.py プロジェクト: uganyasavur/program-y
 def test_match_word(self):
     topic = PatternOneOrMoreWildCardNode("*")
     match = Match(Match.TOPIC, topic, "Hello")
     self.assertEquals(Match.TOPIC, match.match_type)
     self.assertEquals(topic, match.matched_node)
     self.assertEquals(["Hello"], match.matched_words)
     self.assertEquals("Match=(Topic) Node=(ONEORMORE [*]) Matched=(Hello)", match.to_string())
コード例 #2
0
 def test_match_word(self):
     topic = PatternOneOrMoreWildCardNode("*")
     match = Match(Match.TOPIC, topic, "Hello")
     self.assertEqual(Match.TOPIC, match.match_type)
     self.assertEqual(topic, match.matched_node)
     self.assertEqual(["Hello"], match.matched_words)
     self.assertEqual("Match=(Topic) Node=(ONEORMORE [*]) Matched=(Hello)", match.to_string(self._client_context.brain.tokenizer))
コード例 #3
0
ファイル: test_matcher.py プロジェクト: Freiza/program-y
 def test_match_word(self):
     topic = PatternOneOrMoreWildCardNode("*")
     match = Match(Match.TOPIC, topic, "Hello")
     self.assertEquals(Match.TOPIC, match.match_type)
     self.assertEquals(topic, match.matched_node)
     self.assertEquals(["Hello"], match.matched_words)
     self.assertEquals("Match=(Topic) Node=(ONEORMORE [*]) Matched=(Hello)", match.to_string(self._bot.brain.tokenizer))
コード例 #4
0
ファイル: test_matcher.py プロジェクト: frdino131/RyanCBT
 def test_match_no_word(self):
     topic = PatternOneOrMoreWildCardNode("*")
     match = Match(Match.TOPIC, topic, None)
     self.assertEquals(Match.TOPIC, match.match_type)
     self.assertEquals(topic, match.matched_node)
     self.assertEquals([], match.matched_words)
     self.assertEquals("Match=(Topic) Node=(ONEORMORE [*]) Matched=()",
                       match.to_string(self._bot.brain.tokenizer))
コード例 #5
0
 def test_match_multi_word(self):
     topic = PatternOneOrMoreWildCardNode("*")
     match = Match(Match.TOPIC, topic, None)
     match.add_word("Hello")
     match.add_word("World")
     self.assertEqual(["Hello", "World"], match.matched_words)
     self.assertEqual("Hello World", match.joined_words(self._client_context.brain.tokenizer))
     self.assertEqual("Match=(Topic) Node=(ONEORMORE [*]) Matched=(Hello World)", match.to_string(self._client_context.brain.tokenizer))
コード例 #6
0
ファイル: test_matcher.py プロジェクト: Freiza/program-y
 def test_match_multi_word(self):
     topic = PatternOneOrMoreWildCardNode("*")
     match = Match(Match.TOPIC, topic, None)
     match.add_word("Hello")
     match.add_word("World")
     self.assertEquals(["Hello", "World"], match.matched_words)
     self.assertEquals("Hello World", match.joined_words(self._bot.brain.tokenizer))
     self.assertEquals("Match=(Topic) Node=(ONEORMORE [*]) Matched=(Hello World)", match.to_string(self._bot.brain.tokenizer))