コード例 #1
0
ファイル: test_eliza.py プロジェクト: JChungYS/learnpy
 def test_segment_first_match(self):
     self.assertEqual({
         'foo': ['blue'],
         'x': ['red']
     },
                      eliza.match_segment('foo', ['is', '?x', 'today'],
                                          ['blue', 'is', 'red', 'today'],
                                          {}))
コード例 #2
0
ファイル: test_eliza.py プロジェクト: JChungYS/learnpy
 def test_segment_second_match(self):
     phrase = 'blue is red today and today is tomorrow'
     self.assertEqual(
         {
             'foo': ['blue'],
             'x': ['red', 'today', 'and'],
             'y': ['tomorrow']
         },
         eliza.match_segment('foo', ['is', '?*x', 'today', 'is', '?y'],
                             phrase.split(), {}))
コード例 #3
0
 def test_segment_no_match(self):
     phrase = 'red is blue is not now'
     self.assertFalse(eliza.match_segment('foo', ['is', '?y', 'now', '?z'],
                                          phrase.split(), {}))
コード例 #4
0
 def test_segment_second_match(self):
     phrase = 'blue is red today and today is tomorrow'
     self.assertEqual(
         {'foo': ['blue'], 'x': ['red', 'today', 'and'], 'y': ['tomorrow']},
         eliza.match_segment('foo', ['is', '?*x', 'today', 'is', '?y'],
                             phrase.split(), {}))
コード例 #5
0
 def test_segment_first_match(self):
     self.assertEqual(
         {'foo': ['blue'], 'x': ['red']},
         eliza.match_segment('foo', ['is', '?x', 'today'],
                             ['blue', 'is', 'red', 'today'], {}))
コード例 #6
0
 def test_segment_match_rest(self):
     self.assertEqual(
         {'bar': 'baz', 'foo': ['bah', 'bla']},
         eliza.match_segment('foo', [], ['bah', 'bla'], {'bar': 'baz'}))
コード例 #7
0
ファイル: test_eliza.py プロジェクト: JChungYS/learnpy
 def test_segment_no_match(self):
     phrase = 'red is blue is not now'
     self.assertFalse(
         eliza.match_segment('foo', ['is', '?y', 'now', '?z'],
                             phrase.split(), {}))
コード例 #8
0
ファイル: test_eliza.py プロジェクト: JChungYS/learnpy
 def test_segment_match_rest(self):
     self.assertEqual({
         'bar': 'baz',
         'foo': ['bah', 'bla']
     }, eliza.match_segment('foo', [], ['bah', 'bla'], {'bar': 'baz'}))