Skip to content

Commit

Permalink
Don't return confidence from generate_response method
Browse files Browse the repository at this point in the history
  • Loading branch information
gunthercox committed Jan 15, 2017
1 parent 351971a commit 2804ae2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions chatterbot/chatterbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def get_response(self, input_item, session_id=None):
for preprocessor in self.preprocessors:
input_statement = preprocessor(self, input_statement)

statement, response, confidence = self.generate_response(input_statement, session_id)
statement, response = self.generate_response(input_statement, session_id)

# Learn that the user's input was a valid response to the chat bot's previous output
previous_statement = self.conversation_sessions.get(
Expand All @@ -122,7 +122,7 @@ def get_response(self, input_item, session_id=None):
self.conversation_sessions.update(session_id, (statement, response, ))

# Process the response output with the output adapter
return self.output.process_response(response, confidence, session_id)
return self.output.process_response(response, session_id)

def generate_response(self, input_statement, session_id=None):
"""
Expand All @@ -137,7 +137,7 @@ def generate_response(self, input_statement, session_id=None):
# Select a response to the input statement
response = self.logic.process(input_statement)

return input_statement, response, response.confidence
return input_statement, response

def learn_response(self, statement, previous_statement):
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ def test_response_extra_data(self):

def test_generate_response(self):
statement = Statement('Many insects adopt a tripedal gait for rapid yet stable walking.')
input_statement, response, confidence = self.chatbot.generate_response(statement)
input_statement, response = self.chatbot.generate_response(statement)

self.assertEqual(input_statement, statement)
self.assertEqual(response, statement)
self.assertEqual(confidence, 1)
self.assertEqual(response.confidence, 1)

def test_learn_response(self):
previous_response = Statement('Define Hemoglobin.')
Expand Down

0 comments on commit 2804ae2

Please sign in to comment.