I am currently using elementary OS and I am trying to figure out how to use Chatterbot Library in python.
I have installed the chatterbot library with:
sudo pip3 install chatterbot
I have also installed chatterbot-corpus:
pip install chatterbot-corpus
when i try to run this code with chatterbot:
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
# Create a new chat bot named Charlie
chatbot = ChatBot('Charlie')
trainer = ListTrainer(chatbot)
trainer.train([
"Hi, can I help you?",
"Sure, I'd like to book a flight to Iceland.",
"Your flight has been booked."
])
# Get a response to the input text 'I would like to book a flight.'
response = chatbot.get_response('I would like to book a flight.')
print(response)
it shows this error message:
Traceback (most recent call last):
File "/home/johndoe/chat.py", line 1, in <module>
from chatterbot import ChatBot
File "/usr/local/lib/python3.6/dist-packages/chatterbot/__init__.py", line 4, in <module>
from .chatterbot import ChatBot
File "/usr/local/lib/python3.6/dist-packages/chatterbot/chatterbot.py", line 2, in <module>
from chatterbot.storage import StorageAdapter
File "/usr/local/lib/python3.6/dist-packages/chatterbot/storage/__init__.py", line 1, in <module>
from chatterbot.storage.storage_adapter import StorageAdapter
File "/usr/local/lib/python3.6/dist-packages/chatterbot/storage/storage_adapter.py", line 3, in <module>
from chatterbot.tagging import PosHypernymTagger
File "/usr/local/lib/python3.6/dist-packages/chatterbot/tagging.py", line 4, in <module>
from chatterbot.tokenizers import get_sentence_tokenizer
File "/usr/local/lib/python3.6/dist-packages/chatterbot/tokenizers.py", line 4, in <module>
from chatterbot.corpus import load_corpus, list_corpus_files
File "/usr/local/lib/python3.6/dist-packages/chatterbot/corpus.py", line 5, in <module>
from chatterbot_corpus.corpus import DATA_DIRECTORY
ModuleNotFoundError: No module named 'chatterbot_corpus
Tried this solution from web: https://github.com/gunthercox/ChatterBot/issues/833
did not work.
How do I solve this?Screenshot of my Code
I suggest using pip3 install chatterbot-corpus
I think you installed chatterbot on python3 and chatterbot-corpus on python2