From bb41552340ee15789648db3fd310bb706c9ee047 Mon Sep 17 00:00:00 2001 From: RohitW3code <52714264+Rohitw3code@users.noreply.github.com> Date: Sun, 10 Oct 2021 19:00:41 +0530 Subject: [PATCH] fixed bug SpaCy OSError: Can't find model 'en' approve this , this cause a lot of trouble in deployment of project made with chatterbot --- chatterbot/tagging.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chatterbot/tagging.py b/chatterbot/tagging.py index ea3c31d26..79fbb4636 100644 --- a/chatterbot/tagging.py +++ b/chatterbot/tagging.py @@ -23,7 +23,10 @@ def __init__(self, language=None): self.punctuation_table = str.maketrans(dict.fromkeys(string.punctuation)) - self.nlp = spacy.load(self.language.ISO_639_1.lower()) + if self.language.ISO_639_1.lower() == 'en': + self.nlp = spacy.load('en_core_web_sm') + else: + self.nlp = spacy.load(self.language.ISO_639_1.lower()) def get_text_index_string(self, text): """