Skip to content

Instantly share code, notes, and snippets.

@PiotrKrosniak
Created July 3, 2018 15:22
Show Gist options
  • Save PiotrKrosniak/3b704819e8c84f7e8385c7797e3ea76a to your computer and use it in GitHub Desktop.
Save PiotrKrosniak/3b704819e8c84f7e8385c7797e3ea76a to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
import os
bot = ChatBot('Bot')
bot.set_trainer(ListTrainer)
for files in os.listdir('C:/Users/pkrosniak/PycharmProjects/chatbot/chatterbot-corpus-master/chatterbot_corpus/data/english/'):
data = open('C:/Users/pkrosniak/PycharmProjects/chatbot/chatterbot-corpus-master/chatterbot_corpus/data/english/' + files ,'r'). readlines()
bot.train(data)
while True:
message = input ('You')
if message.strip() != 'Bye':
reply = bot.get_response(message)
print('ChatBot :',reply)
if message.strip() == 'Bye':
print('ChatBot : Bye')
break
@PiotrKrosniak
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment