Skip to content

Commit

Permalink
Don't overide get method on ApproximateSentenceMatchAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
gunthercox committed Nov 5, 2016
1 parent 88bf211 commit ad80f8c
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions chatterbot/adapters/logic/approximate_sentence_match.py
Expand Up @@ -11,29 +11,4 @@ def __init__(self, **kwargs):
self.compare_statements = kwargs.get(
'statement_comparison_function',
jaccard_similarity
)

def get(self, input_statement):
"""
Takes a statement string and a list of statement strings.
Returns the closest matching statement from the list.
"""
statement_list = self.context.storage.get_response_statements()

if not statement_list:
if self.has_storage_context:
# Use a randomly picked statement
return 0, self.context.storage.get_random()
else:
raise self.EmptyDatasetException()

confidence = -1
sentence_match = input_statement
# Find the matching known statement
for statement in statement_list:
ratio = self.compare_statements(input_statement, statement)
if ratio:
closest_match = statement
else:
closest_match = statement
return 0.5, closest_match
)

0 comments on commit ad80f8c

Please sign in to comment.