python - spaCy:找不到模型“它”
问题描述
你能告诉我我在下面的代码中缺少什么吗?我正在尝试使用一些定义的函数(在帖子的底部),这些函数可以帮助我删除停用词、形成二元组并进行一些词形还原。语言是意大利语。我正在使用空间来这样做。
!python -m spacy download it_core_news_sm
import spacy
nlp = spacy.load("it_core_news_sm")
data_words_nostops = remove_stopwords(tok_text_list)
# Form Bigrams
data_words_bigrams = make_bigrams(data_words_nostops)
nlp = spacy.load('it', disable=['parser', 'ner'])
# Do lemmatization keeping only noun, adj, vb, adv
data_lemmatized = lemmatization(data_words_bigrams, allowed_postags=['NOUN', 'ADJ', 'VERB', 'ADV'])
print(data_lemmatized[:1])
在哪里
tok_text_list= [['papa',
',',
"l'aspirante",
'pilota',
'anni',
'morto',
'fiume',
'tevere',
'seguito',
"all'incidente",
"l'aereo",
'.',
'spiaggia',
'campo',
'mare',
'é',
'vietata',
'disabili',
'.'], [...]]
我得到的错误是:
OSError Traceback (most recent call last)
<ipython-input-216-775b3f412d6f> in <module>
---> 14 nlp = spacy.load('it', disable=['parser', 'ner'])
15
16 # Do lemmatization keeping only noun, adj, vb, adv
OSError: [E050] Can't find model 'it'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.
也许我忘记在代码中包含某些内容或下载其他文件。我还尝试按照此处的建议重新运行所有内容:Loading the spacy German language model into a jupyter notebook。我正在使用木星笔记本。
谢谢
解决方案
!python -m spacy download it
也许也只安装意大利语?
推荐阅读
- db2 - Db2 中身份列的奇怪行为?
- amazon-web-services - 向特定 lambda 别名或版本发送 s3 事件通知的方式
- linux - Pscp(腻子)有时会在重复 ssh 握手期间挂起
- moodle - 通过 Moodle 的 api 从 mdl_user_enrolments 创建的时间
- wkhtmltopdf - wkhtmltopdf 由于网络错误退出并显示代码 1:HostNotFoundError
- redmine - 如何在Redmine上打开新项目?
- ruby-on-rails - Ubuntu 从 16.04 升级到 18.04 后 Rmagick 失败
- json - 如何将json对象绑定到角度材料形式
- c# - 我想更改 DataGrid 选定的行高而 DataGrid 中的数据保持不变
- ruby-on-rails - Ruby on Rails - Autoprefixer 不支持 Node v4.9.1。更新它。怎么修?