Код: Выделить всё
#this is the code that I wrote
from chatterbot import ChatBot
bot = ChatBot('Math', logic_adapters=[{'import_path':'chatterbot.logic.MathematicalEvaluation'}])
while True:
user_in = input()
print("chatbot: ", bot.get_response(user_in))
AttributeError: у объекта «NoneType» нет атрибута «текст»
p>
со ссылкой на эту строку далее в коде
Код: Выделить всё
text=result.text
Код: Выделить всё
class ResultOption:
def __init__(self, statement, count=1):
self.statement = statement
self.count = count
# If multiple adapters agree on the same statement,
# then that statement is more likely to be the correct response
if len(results) >= 3:
result_options = {}
for result_option in results:
result_string = result_option.text + ':' + (result_option.in_response_to or '')
if result_string in result_options:
result_options[result_string].count += 1
if result_options[result_string].statement.confidence < result_option.confidence:
result_options[result_string].statement = result_option
else:
result_options[result_string] = ResultOption(result_option)
most_common = list(result_options.values())[0]
for result_option in result_options.values():
if result_option.count > most_common.count:
most_common = result_option
if most_common.count > 1:
result = most_common.statement
# Always the console says this
response = Statement(
# error is here !!
text=result.text,
in_response_to=input_statement.text,
conversation=input_statement.conversation,
persona='bot:' + self.name
)
response.confidence = result.confidence
return response
Подробнее здесь: https://stackoverflow.com/questions/793 ... ot-library
Мобильная версия