

def get(self, input_statement, statement_list=None):
    '\n        Takes a statement string and a list of statement strings.\n        Returns the closest matching statement from the list.\n        '
    statement_list = self.get_available_statements(statement_list)
    if (not statement_list):
        if self.has_storage_context:
            return (0, self.context.storage.get_random())
        else:
            raise EmptyDatasetException
    text_of_all_statements = []
    for statement in statement_list:
        text_of_all_statements.append(statement.text)
    if (input_statement.text in text_of_all_statements):
        return (1, input_statement)
    (closest_match, confidence) = process.extract(input_statement.text, text_of_all_statements, limit=1)[0]
    confidence /= 100.0
    return (confidence, next((s for s in statement_list if (s.text == closest_match)), None))

dataset/ETHPy150Open gunthercox/ChatterBot/chatterbot/adapters/logic/closest_match.py ClosestMatchAdapter.get/original