Skip to content

Commit

Permalink
minor restructuring for response creation
Browse files Browse the repository at this point in the history
  • Loading branch information
domanchi committed Sep 7, 2019
1 parent 0666bb5 commit 998a0a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions chatterbot/chatterbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ def generate_response(self, input_statement, additional_response_selection_param
:param input_statement: The input statement to be processed.
"""
Statement = self.storage.get_object('statement')

results = []
result = None
max_confidence = -1
Expand Down Expand Up @@ -196,6 +194,10 @@ def __init__(self, statement, count=1):
if most_common.count > 1:
result = most_common.statement

return self.create_response(input_statement, result)

def create_response(self, input_statement, result):
Statement = self.storage.get_object('statement')
response = Statement(
text=result.text,
in_response_to=input_statement.text,
Expand Down

0 comments on commit 998a0a1

Please sign in to comment.