Python Forum
How to add multiple lines response in chatterbot?
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to add multiple lines response in chatterbot?
#1
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
Reply


Messages In This Thread
How to add multiple lines response in chatterbot? - by PrateekG - May-16-2018, 06:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Amazon AWS - how to install the library chatterbot wpaiva 9 3,930 Feb-01-2020, 08:18 AM
Last Post: brighteningeyes
  Scrape multiple lines with regex greetings 2 3,075 Jul-04-2018, 09:09 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020