Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. from chatterbot import ChatBot
  2. from chatterbot.trainers import ChatterBotCorpusTrainer
  3. import os
  4.  
  5. bot= ChatBot('Bot')
  6. trainer = ChatterBotCorpusTrainer(bot)
  7.  
  8. corpus_path='/home/rat/Desktop/chatterbot-corpus-master/chatterbot_corpus/data/english/'
  9.  
  10. for file in os.listdir(corpus_path):
  11. trainer.train(corpus_path + file)
  12.  
  13. while True:
  14. message = input('You: ')
  15. if message.strip() == 'Bye':
  16. print('ChatBot: Bye')
  17. break
  18. else:
  19. reply = bot.get_response(message)
  20. print('ChatBot:', reply)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement