首页 > 解决方案 > 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。我正在使用木星笔记本。

谢谢

标签: pythonspacy

解决方案


!python -m spacy download it

也许也只安装意大利语?


推荐阅读