diff --git a/chatterbot/corpus.py b/chatterbot/corpus.py index a57d23530..b718ffb50 100644 --- a/chatterbot/corpus.py +++ b/chatterbot/corpus.py @@ -24,8 +24,9 @@ def get_file_path(dotted_path, extension='json'): corpus_path = os.path.join(*parts) - if os.path.exists(corpus_path + '.{}'.format(extension)): - corpus_path += '.{}'.format(extension) + path_with_extension = '{}.{}'.format(corpus_path, extension) + if os.path.exists(path_with_extension): + corpus_path = path_with_extension return corpus_path diff --git a/chatterbot/logic/mathematical_evaluation.py b/chatterbot/logic/mathematical_evaluation.py index 642e57561..ed6269afd 100644 --- a/chatterbot/logic/mathematical_evaluation.py +++ b/chatterbot/logic/mathematical_evaluation.py @@ -55,7 +55,8 @@ def process(self, statement, additional_response_selection_parameters=None): response = Statement(text=expression) try: - response.text += ' = ' + str( + response.text = '{} = {}'.format( + response.text, mathparse.parse(expression, language=self.language.ISO_639.upper()) )