Closed Timmytubby closed 6 years ago
Hi @Timmytubby , it looks like you haven't installed any spacy language models, or haven't linked "en" to whichever English-language model you have installed. Check out this section of the installation guide, and follow the link to spacy's docs for details.
If this is indeed the problem, you can quickly verify it by doing
import spacy
nlp = spacy.load("en")
Dear mr.Wilde,
Thanks for the great support, somehow i missed this importing of spacy. Everything works like a charm now.
Regards, Timmytubby
In case someone has the same issue and wonders how to create the link you can run python3 -m spacy link en_core_web_lg en
to easily create it (this assumes you have en_core_web_lg already installed)
After trail and error on installing the library, i tried to follow the example to get some quick experience with this lib.
Example is here: https://pypi.org/project/textacy/
Code i putted in: import os import textacy print(os.getcwd()) text = ( 'Since the so-called "statistical revolution" in the late 1980s and mid 1990s, ' 'much Natural Language Processing research has relied heavily on machine learning. ' 'Formerly, many language-processing tasks typically involved the direct hand coding ' 'of rules, which is not in general robust to natural language variation. ' 'The machine-learning paradigm calls instead for using statistical inference ' 'to automatically learn such rules through the analysis of large corpora ' 'of typical real-world examples.')
textacy.text_utils.KWIC(text, 'language', window_width=35)
textacy.preprocess_text(text, lowercase=True, no_punct=True) doc = textacy.Doc(text) doc
Expected Behavior
Like the example on site.
Current Behavior(Debug result after run)
/Users/timmytubby/PycharmProjects/untitled/venv/bin/python /Users/timmytubby/PycharmProjects/untitled/Timmytubby.py /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219:RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(*args, kwds) /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192, got 176 return f(*args, *kwds) /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(args, kwds) /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192, got 176 return f(*args, *kwds) Traceback (most recent call last): /Users/timmytubby/PycharmProjects/untitled File "/Users/timmytubby/PycharmProjects/untitled/Timmytubby.py", line 16, in
1980s and mid 1990s, much Natural Language Processing research has relied hea
doc = textacy.Doc(text)
n machine learning. Formerly, many language -processing tasks typically involve
File "/Users/timmytubby/PycharmProjects/untitled/venv/lib/python3.7/site-packages/textacy/doc.py", line 114, in init
s not in general robust to natural language variation. The machine-learning pa
self._init_from_text(content, metadata, lang)
File "/Users/timmytubby/PycharmProjects/untitled/venv/lib/python3.7/site-packages/textacy/doc.py", line 136, in _init_from_text
spacy_lang = cache.load_spacy(langstr)
File "/Users/timmytubby/PycharmProjects/untitled/venv/lib/python3.7/site-packages/cachetools/init.py", line 46, in wrapper
v = func( args, kwargs)
File "/Users/timmytubby/PycharmProjects/untitled/venv/lib/python3.7/site-packages/textacy/cache.py", line 99, in load_spacy
return spacy.load(name, disable=disable)
File "/Users/timmytubby/PycharmProjects/untitled/venv/lib/python3.7/site-packages/spacy/init.py", line 15, in load
return util.load_model(name, overrides)
File "/Users/timmytubby/PycharmProjects/untitled/venv/lib/python3.7/site-packages/spacy/util.py", line 119, in load_model
raise IOError(Errors.E050.format(name=name))
OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.
Process finished with exit code 1
Possible Solution
Haven't got the slightest clue
Your Environment
OS-x: 10.13.6 Pycharm: 2018.2.1 Python 3.7 textacy: 0.6.2 spacy: 2.0.12
Thnx in advance