【已解决】Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid

最近在尝试rasa-core的quickstart小案例starter-pack-rasa-stack,在执行make过程中遇到以下错误:
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.

首先是按照文档上执行python -m spacy download en会遇到Read timed out.的错误,找了百度网盘下载以后pip安装,运行时仍然是Can't find model 'en'

解决方法如下:
pip list会发现model名为en-core-web-lg
打开python,运行
>>>import en_core_web_lg
成功~因此model名不是"en"而是en_core_web_lg

查看错误会发现是在spacy_utils.py脚本里出错:
File"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rasa_nlu/utils/spacy_utils.py", line 73, in create nlp = spacy.load(spacy_model_name, parser=False)
在这里用到了spacy_model_name,修改其为正确值:

if not spacy_model_name:
	spacy_model_name = cfg.language+'_core_web_lg'  #!!!
	component_conf["model"] = cfg.language

保存再运行就编译通过啦

你可能感兴趣的:(NLP)