在 Spacy 中下载西班牙模型时出错
Error downloading Spanish model in Spacy
我正在尝试使用西班牙模式的 Spacy。
from spacy.es import Spanish
nlp = Spanish(path=None)
doc = nlp(u'Hola me llamo Sergio y estoy probando la librería.')
sentence = next(doc.sents)
执行上面的脚本我得到以下消息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "spacy/tokens/doc.pyx", line 434, in __get__ (spacy/tokens/doc.cpp:9664)
ValueError: sentence boundary detection requires the dependency parse, which requires data to be installed. If you haven't done so, run:
python -m spacy download es
to install the data
在那之后,在命令行中我 运行 'python -m spacy download es' 我得到了另一个错误:
$ python -m spacy download es
Compatibility error
No compatible model found for 'es' (spaCy v1.8.2).
有没有人成功下载过西班牙语模型?我的步骤是否正确?
您可以通过以下方式下载西班牙语模型:
python -m spacy download es_core_news_sm
您可以在以下位置看到两种不同的西班牙模型:
然后,您加载模型:
import spacy
nlp = spacy.load('es_core_news_sm')
doc = nlp(r"La casa es amarilla.")
我正在尝试使用西班牙模式的 Spacy。
from spacy.es import Spanish
nlp = Spanish(path=None)
doc = nlp(u'Hola me llamo Sergio y estoy probando la librería.')
sentence = next(doc.sents)
执行上面的脚本我得到以下消息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "spacy/tokens/doc.pyx", line 434, in __get__ (spacy/tokens/doc.cpp:9664)
ValueError: sentence boundary detection requires the dependency parse, which requires data to be installed. If you haven't done so, run:
python -m spacy download es
to install the data
在那之后,在命令行中我 运行 'python -m spacy download es' 我得到了另一个错误:
$ python -m spacy download es
Compatibility error
No compatible model found for 'es' (spaCy v1.8.2).
有没有人成功下载过西班牙语模型?我的步骤是否正确?
您可以通过以下方式下载西班牙语模型:
python -m spacy download es_core_news_sm
您可以在以下位置看到两种不同的西班牙模型:
然后,您加载模型:
import spacy
nlp = spacy.load('es_core_news_sm')
doc = nlp(r"La casa es amarilla.")