gunthercox / chatterbot-corpus

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

Corpus not found #152

Open 1997showroom opened 5 years ago

1997showroom commented 5 years ago

I'm Getting this error...

from chatterbot import ChatBot #import the chatbot
from chatterbot.trainers import ChatterBotCorpusTrainer
import os

bot= ChatBot('Bot')
trainer = ChatterBotCorpusTrainer(bot)

corpus_path = '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/chatterbot_corpus/data/english'

for file in os.listdir(corpus_path):
    trainer.train(corpus_path + file)

while True:
    message = input('You:')
    print(message)
    if message.strip() == 'Bye':
        print('ChatBot: Bye')
        break
    else:
        reply = bot.get_response(message)
        print('ChatBot:', reply)`

this is the error

/Users/singlefawn/Desktop/Our Realm/1997/Programs/random gallery/venv/lib/python3.7/site-packages/chatterbot/storage/jsonfile.py:26: UnsuitableForProductionWarning: The JsonFileStorageAdapter is not recommended for production environments.
  self.UnsuitableForProductionWarning
Traceback (most recent call last):
  File "/Users/singlefawn/Desktop/Our Realm/1997/Programs/random gallery/chat_1_2.py", line 6, in <module>
    trainer = ChatterBotCorpusTrainer(bot)
  File "/Users/singlefawn/Desktop/Our Realm/1997/Programs/random gallery/venv/lib/python3.7/site-packages/chatterbot/trainers.py", line 101, in __init__
    from .corpus import Corpus
  File "/Users/singlefawn/Desktop/Our Realm/1997/Programs/random gallery/venv/lib/python3.7/site-packages/chatterbot/corpus/__init__.py", line 6, in <module>
    from chatterbot_corpus import Corpus
ImportError: cannot import name 'Corpus' from 'chatterbot_corpus' (/Users/singlefawn/Desktop/Our Realm/1997/Programs/random gallery/venv/lib/python3.7/site-packages/chatterbot_corpus/__init__.py)
vkosuri commented 5 years ago

could you try python virtual environment https://realpython.com/python-virtual-environments-a-primer/

alexm622 commented 4 years ago

Im also getting this error Traceback (most recent call last): File "chatbot.py", line 1, in <module> from chatterbot import ChatBot File "/home/server/.local/lib/python3.6/site-packages/chatterbot/__init__.py", line 4, in <module> from .chatterbot import ChatBot File "/home/server/.local/lib/python3.6/site-packages/chatterbot/chatterbot.py", line 2, in <module> from chatterbot.storage import StorageAdapter File "/home/server/.local/lib/python3.6/site-packages/chatterbot/storage/__init__.py", line 1, in <module> from chatterbot.storage.storage_adapter import StorageAdapter File "/home/server/.local/lib/python3.6/site-packages/chatterbot/storage/storage_adapter.py", line 3, in <module> from chatterbot.tagging import PosHypernymTagger File "/home/server/.local/lib/python3.6/site-packages/chatterbot/tagging.py", line 4, in <module> from chatterbot.tokenizers import get_sentence_tokenizer File "/home/server/.local/lib/python3.6/site-packages/chatterbot/tokenizers.py", line 4, in <module> from chatterbot.corpus import load_corpus, list_corpus_files File "/home/server/.local/lib/python3.6/site-packages/chatterbot/corpus/__init__.py", line 6, in <module> from chatterbot_corpus import Corpus ImportError: cannot import name 'Corpus'

and the code im using is the basic one from the webpage

` from chatterbot import ChatBot from chatterbot.trainers import ListTrainer

bot = ChatBot( 'Norman', storage_adapter='chatterbot.storage.SQLStorageAdapter', database_uri='sqlite:///database.sqlite3' )

trainer = ListTrainer(bot)

trainer.train([ "Hi, can I help you?", "Sure, I'd like to book a flight to Iceland.", "Your flight has been booked." ])

response = bot.get_response('I would like to book a flight.') print(response) and i have the packages language-selector (0.1) MarkupSafe (1.0) mathparse (0.1.2) multidict (4.5.2) murmurhash (1.0.2) netifaces (0.10.4) nltk (3.4.5) numpy (1.17.3) oauthlib (3.1.0) PAM (0.4.2) Pint (0.9) pip (9.0.1) plac (0.9.6) preshed (2.0.1) pyasn1 (0.4.2) pyasn1-modules (0.2.1) pycrypto (2.6.1) pygobject (3.26.1) PyJWT (1.5.3) pymongo (3.9.0) pyOpenSSL (17.5.0) pyserial (3.4) python-apt (1.6.3+ubuntu1) python-dateutil (2.8.0) python-debian (0.1.32) python-twitter (3.5) pytz (2019.3) pyxdg (0.25) PyYAML (5.1.2) requests (2.22.0) requests-oauthlib (1.2.0) requests-unixsocket (0.1.5) ruamel.yaml (0.15.0) SecretStorage (2.3.1) service-identity (16.0.0) setuptools (39.0.1) six (1.12.0) spacy (2.1.8) SQLAlchemy (1.2.19) srsly (0.1.0) ssh-import-id (5.7) systemd-python (234) thinc (7.0.8) tqdm (4.36.1) Twisted (17.9.0) typing-extensions (3.7.4) ufw (0.35) unattended-upgrades (0.1) urllib3 (1.25.6) wasabi (0.2.2) websockets (6.0) wheel (0.30.0) yarl (1.3.0) zope.interface (4.3.2) ` installed using Ubuntu Server