Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

How to add multiple lines response in chatterbot?

I am trying to build a simple chat bot using Pythons's chatterbot.
I am training this bot with the help of ListTrainer.
I have created a txt file containing questions-answers.
Problem I am facing with it is that if answers contains multiple lines, bot includes only first line in response.
Can you please help me to solve this issue?
from chatterbot.trainers import ListTrainer
from chatterbot import ChatBot
bot = ChatBot('MyBot')
conv = open('chats.txt','r').readlines()
bot.set_trainer(ListTrainer)
bot.train(conv)
while True:
request = input('You:')
response = bot.get_response(request)

print('Bot:',response)


And sample of chat.txt file is as below-
What are some common warning signs of stress and/or depression in men?
1. General signs of stress: Fast heart rate, Muscle tension Increase in blood pressure, Tense stomach
2. Long-term signs of stress: Frequent cold or flu, Headaches Trouble, sleeping Skin problems
by

1 Answer

Bharatv4tg1
The suggested code snippet is giving me below error-
AttributeError: 'list' object has no attribute 'apend'

Login / Signup to Answer the Question.