コード例 #1
0
 def test_should_find_multiple_choices_within_an_utterance(self):
     found = Find.find_choices("the red and blue ones please.",
                               _color_choices)
     assert len(
         found) == 2, f"Invalid token count of '{len(found)}' returned."
     assert_result(found[0], 4, 6, "red")
     assert_choice(found[0], "red", 0, 1.0)
     assert_choice(found[1], "blue", 2, 1.0)
コード例 #2
0
 def test_should_find_multiple_choices_that_overlap(self):
     found = Find.find_choices("the bread pudding and bread please.",
                               _overlapping_choices)
     assert len(
         found) == 2, f"Invalid token count of '{len(found)}' returned."
     assert_result(found[0], 4, 16, "bread pudding")
     assert_choice(found[0], "bread pudding", 1, 1.0)
     assert_choice(found[1], "bread", 0, 1.0)
コード例 #3
0
 def test_should_find_multiple_values_that_overlap(self):
     found = Find.find_values('the bread pudding and bread please.',
                              _overlapping_values)
     assert len(
         found) == 2, f"Invalid token count of '{len(found)}' returned."
     assert_result(found[0], 4, 16, 'bread pudding')
     assert_value(found[0], 'bread pudding', 1, 1.0)
     assert_value(found[1], 'bread', 0, 1.0)
コード例 #4
0
 def test_should_find_multiple_values_within_an_utterance(self):
     found = Find.find_values('the red and blue ones please.',
                              _color_values)
     assert len(
         found) == 2, f"Invalid token count of '{len(found)}' returned."
     assert_result(found[0], 4, 6, 'red')
     assert_value(found[0], 'red', 0, 1.0)
     assert_value(found[1], 'blue', 2, 1.0)
コード例 #5
0
 def test_should_find_a_simple_value_in_an_utterance(self):
     found = Find.find_values("the red one please.", _color_values)
     assert len(
         found) == 1, f"Invalid token count of '{len(found)}' returned."
     assert_result(found[0], 4, 6, "red")
     assert_value(found[0], "red", 0, 1.0)
コード例 #6
0
 def test_should_accept_null_utterance_in_find_choices(self):
     found = Find.find_choices(None, _color_choices)
     assert not found
コード例 #7
0
 def test_should_correctly_disambiguate_between_similar_values(self):
     found = Find.find_values("option B", _similar_values,
                              FindValuesOptions(allow_partial_matches=True))
     assert len(
         found) == 1, f"Invalid token count of '{len(found)}' returned."
     assert_value(found[0], "option B", 1, 1.0)
コード例 #8
0
 def test_should_find_a_simple_value_in_a_single_word_utterance(self):
     found = Find.find_values('red', _color_values)
     assert len(
         found) == 1, f"Invalid token count of '{len(found)}' returned."
     assert_result(found[0], 0, 2, 'red')
     assert_value(found[0], 'red', 0, 1.0)
コード例 #9
0
 def test_should_find_a_single_choice_in_an_utterance(self):
     found = Find.find_choices('the red one please.', _color_choices)
     assert len(
         found) == 1, f"Invalid token count of '{len(found)}' returned."
     assert_result(found[0], 4, 6, 'red')
     assert_choice(found[0], 'red', 0, 1.0, 'red')