Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_levenshtein_distance_comparisons(self):
"""
Test the levenshtein distance comparison algorithm.
"""
self.chatbot.logic_adapters[0] = BestMatch(
self.chatbot,
statement_comparison_function=comparisons.LevenshteinDistance,
response_selection_method=response_selection.get_first_response
)
trainer = get_list_trainer(self.chatbot)
trainer.train(STATEMENT_LIST)
self.assert_response_duration_is_less_than(1)
def test_spacy_similarity_comparisons(self):
"""
Test the spacy similarity comparison algorithm.
"""
self.chatbot.logic_adapters[0] = BestMatch(
self.chatbot,
statement_comparison_function=comparisons.SpacySimilarity,
response_selection_method=response_selection.get_first_response
)
trainer = get_list_trainer(self.chatbot)
trainer.train(STATEMENT_LIST)
self.assert_response_duration_is_less_than(3)
def test_spacy_similarity_comparisons(self):
"""
Test the spacy similarity comparison algorithm.
"""
self.chatbot.logic_adapters[0] = BestMatch(
self.chatbot,
statement_comparison_function=comparisons.SpacySimilarity,
response_selection_method=response_selection.get_first_response
)
trainer = get_list_trainer(self.chatbot)
trainer.train(STATEMENT_LIST)
self.assert_response_duration_is_less_than(3)
def setup_module():
chatbot = ChatBot('setup')
chatbot.logic_adapters = [
LogicAdapter(
chatbot,
statement_comparison_function=comparisons.jaccard_similarity
),
LogicAdapter(
chatbot,
statement_comparison_function=comparisons.synset_distance
),
]
chatbot.initialize()
def setUp(self):
super().setUp()
self.search_algorithm = IndexedTextSearch(
self.chatbot,
statement_comparison_function=comparisons.LevenshteinDistance
)
def setUp(self):
super().setUp()
self.compare = comparisons.SpacySimilarity(
language=languages.ENG
)
def test_levenshtein_distance_comparisons(self):
"""
Test the levenshtein distance comparison algorithm.
"""
self.chatbot.logic_adapters[0] = BestMatch(
self.chatbot,
statement_comparison_function=comparisons.LevenshteinDistance,
response_selection_method=response_selection.get_first_response
)
trainer = get_list_trainer(self.chatbot)
trainer.train(STATEMENT_LIST)
self.assert_response_duration_is_less_than(1)
def setUp(self):
super().setUp()
self.compare = comparisons.JaccardSimilarity(
language=languages.ENG
)
def setup_module():
chatbot = ChatBot('setup')
chatbot.logic_adapters = [
LogicAdapter(
chatbot,
statement_comparison_function=comparisons.jaccard_similarity
),
LogicAdapter(
chatbot,
statement_comparison_function=comparisons.synset_distance
),
]
chatbot.initialize()
def setUp(self):
super().setUp()
self.compare = comparisons.LevenshteinDistance(
language=languages.ENG
)