gunthercox / chatterbot-corpus

A multilingual dialog corpus
http://chatterbot-corpus.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.37k stars 1.14k forks source link

FileNotFoundError: [Errno 2] No such file or directory: #117

Closed nish-sura closed 5 years ago

nish-sura commented 5 years ago

i am getting this error. does anyone know how to fix it?

CODE_ 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/nisha\chatterbot-corpus-master\chatterbot_corpus\data\english'): data = open('C:/Users/nisha\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

ERROR- FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/nisha\chatterbot-corpus-master\chatterbot_corpus\data\englishai.yml'

gunthercox commented 5 years ago

Hi @nish-sura, this looks like a duplicate of https://github.com/gunthercox/ChatterBot/issues/1624. I'll respond there.

JJSuriyaPrakash commented 4 years ago

from chatterbot import ChatBot from chatterbot.trainers import ListTrainer import os import spacy nlp = spacy.load("en_core_web_sm") bot = ChatBot('Bot') trainer=ListTrainer(bot) for files in os.listdir("""C\Users\suriya prakash\chatterbot-corpus-master\chatterbot-corpus-master\chatterbot_corpus\data\english\"""): data = open("""C\User\suriya prakash\chatterbot-corpus-master\chatterbot-corpus-master\chatterbot_corpus\data\english\"""+files,'r').readlines() trainer.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 hey everyone, the code is correct but when I try to train the chat bot in cmd it shows the following error, C:\Users\suriya prakash\ChatBot>python chatbot_train.py File "chatbot_train.py", line 9 for files in os.listdir("""C\Users\suriya prakash\chatterbot-corpus-master\chatterbot-corpus-master\chatterbot_corpus\data\english\"""): data = open("""C\User\suriya prakash\chatterbot-corpus-master\chatterbot-corpus-master\chatterbot_corpus\data\english\"""+files,'r').readlines() ^ SyntaxError: invalid syntax

I cant find what is the error here!!

nbthinh commented 3 years ago

This is my code: ` from flask import Flask, render_template, request from chatterbot import ChatBot from chatterbot.trainers import ChatterBotCorpusTrainer

app = Flask(name)

english_bot = ChatBot("Chatterbot", storage_adapter="chatterbot.storage.SQLStorageAdapter") trainer = ChatterBotCorpusTrainer(english_bot) trainer.train("chatterbot.corpus.english")

@app.route("/") def home(): return render_template("index.html")

@app.route("/get") def get_bot_response(): userText = request.args.get('msg') return str(english_bot.get_response(userText))

if name == "main": app.run() ` It raise error:

Traceback (most recent call last): File "app.py", line 9, in trainer.train("chatterbot.corpus.english") File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chatterbot/trainers.py", line 135, in train for corpus, categories, file_path in load_corpus(*data_file_paths): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chatterbot/corpus.py", line 84, in load_corpus corpus_data = read_corpus(file_path) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chatterbot/corpus.py", line 58, in read_corpus with io.open(file_name, encoding='utf-8') as data_file: FileNotFoundError: [Errno 2] No such file or directory: '/Users/nguyenbuuthinh/chatterbot_corpus/data/English'

I can't find error? Would you mind helping me?