Created
July 3, 2018 15:22
-
-
Save PiotrKrosniak/3b704819e8c84f7e8385c7797e3ea76a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need https://github.com/gunthercox/ChatterBot and https://github.com/gunthercox/chatterbot-corpus