Отсутствует текстовый атрибут «язык Python, библиотека Chatterbot».Python

Программы на Python
Ответить
Anonymous
 Отсутствует текстовый атрибут «язык Python, библиотека Chatterbot».

Сообщение Anonymous »

Я работаю над математическим чат-ботом, и у меня есть этот код на Python:

Код: Выделить всё

#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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»