gunthercox / ChatterBot

ChatterBot is a machine learning, conversational dialog engine for creating chat bots
https://chatterbot.readthedocs.io
BSD 3-Clause "New" or "Revised" License
14.12k stars 4.45k forks source link

spacy.load("en_core_web_sm") #2235

Open CGyan10 opened 2 years ago

CGyan10 commented 2 years ago

database_uri='sqlite:///database.sqlite3'

error when run code with above line

error shows

[E941] Can't find model 'en'. It looks like you're trying to load a model from a shortcut, which is obsolete as of spaCy v3.0. To load the model, use its full name instead:

nlp = spacy.load("en_core_web_sm")

eddiecarbin commented 2 years ago

Following. I'm getting a lot of problems that have to do with outdated modules.

eddiecarbin commented 2 years ago

looks like it was answered here. https://github.com/gunthercox/ChatterBot/issues/2194

StevieEngbrock commented 2 years ago

I got my bot to work. I also had this issue. I think I installed the old Spacy, and downloaded the old embeddings manually. I can only get my bot to work on Python 3.7 but it works. I'm also using the "Chatterbot2" module. If I use just plain Chatterbot it still freaks out. I had to install alot of the requirements manually. I hope this helps someone. I'm not sure if I installed Chatterbot2 directly from Github using pip but I may have. Sorry if I can't remember details clearly but I have memory problems. Anyway those are some ideas some of you can try if you want.

britobeatriz commented 2 years ago

do you like this:

class ENGSM: ISO_639_1 = 'en_core_web_sm'

chatbot = ChatBot( "Charlie", tagger_language=ENGSM # <-- this is a language )

khalidt commented 3 months ago

To resolve this issue, you have a many options.

Option 1: Quick Fix by Creating a New Language Object

  1. Use the New Class in Your Script: As suggested by @britobeatriz, the simplest method involves creating a new language object that ChatterBot can use. You need to mention tagger_language.

Option 2: Modify the Existing ENG Class

If you prefer not to create a new class in your script, you can modify the existing ENG class in languages.py to use the full model name.

class ENG:
    ISO_639_1 = 'en_core_web_sm'  # Change this to 'en_core_web_sm'
    ISO_639 = 'eng'
    ENGLISH_NAME = 'English'

No changes are needed in your script if you choose this option. The ChatBot will automatically use the modified ENG class.

Option 3: Create a New Class ENGSM for the Updated spaCy Model

This option involves creating a new language class ENGSM that uses the correct spaCy model name. Here’s how to implement it:

  1. Create a New Language Class: Add a new class ENGSM to languages.py with the correct model name.

class ENG: ISO_639_1 = 'en' ISO_639 = 'eng' ENGLISH_NAME = 'English'

class ENGSM: # Add this new class ISO_639_1 = 'en_core_web_sm' ISO_639 = 'eng' ENGLISH_NAME = 'English'

2. Use the New Class in Your Script:
``` python
from chatterbot.languages import ENGSM

chatbot = ChatBot(
    "Example Bot",
    tagger_language=ENGSM
)