找不到型号&en_core_web_md;。它看起来不像是快捷方式链接、Python包或指向数据目录的有效路径

2022-05-15 00:00:00 python nlp spacy text data-generation

问题描述

我已安装Spacy并使用以下命令下载了en_core_web_sm: PIP安装空间 Python-m空格下载en_core_web_sm 也试过了 PIP3安装https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz

我的Spacy版本:2.2.0 我的Python版本:3.7.4

但是,它仍然显示错误: OSError: [E050] Can't find model 'en_core_web_md'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.

*import aqgFunction
import spacy
import en_core_web_sm
nlp = en_core_web_sm.load()
# Main Function
def main():
    # Create AQG object
    aqg = aqgFunction.AutomaticQuestionGenerator()
    inputTextPath = "E:Automatic-Question-Generator-masterAutomatic-Question-Generator-masterAutomaticQuestionGeneratorDBdb.txt"
    readFile = open(inputTextPath, 'r+', encoding="utf8")
    #readFile = open(inputTextPath, 'r+', encoding="utf8", errors = 'ignore')
    inputText = readFile.read()
    #inputText = '''I am Dipta. I love codding. I build my carrier with this.'''
    questionList = aqg.aqgParse(inputText)
    aqg.display(questionList)
    #aqg.DisNormal(questionList)
    return 0
# Call Main Function
if __name__ == "__main__":
    main()*

解决方案

在Jupyter笔记本中使用:

!python -m spacy download en_core_web_md 

然后:

[Ctrl+M] or `Restart runtime` from menu bar

相关文章