简体   繁体   English

如何创建指向 spacy 的快捷方式链接?

[英]How can I create a shortcut link to spacy?

I'm currently enrolled at a Python course, where the lecturer has asked us to download the spaCy package and subsequently create a shortcut link using the following commands:我目前正在参加 Python 课程,讲师要求我们下载 spaCy 包,然后使用以下命令创建快捷链接:

1) pip install spacy 2) python -m spacy download en_core_web_lg 3) python -m spacy link en_core_web_lg en_default 1) pip install spacy 2) python -m spacy 下载 en_core_web_lg 3) python -m spacy 链接 en_core_web_lg en_default

The "pip command" does not work for me, however, so I used a "conda command" instead: conda install -c conda-forge spacy-model-en_core_web_lg但是,“pip 命令”对我不起作用,所以我改用了“conda 命令”: conda install -c conda-forge spacy-model-en_core_web_lg

This worked.这奏效了。 But I still cannot create the shortcut link (no 3).但我仍然无法创建快捷链接(没有 3)。 So right now, I cannot use the collection of NLP stuff in jupyter notebook.所以现在,我不能在 jupyter notebook 中使用 NLP 的集合。

The aim is to do the following two steps in jupyter:目的是在jupyter中做以下两步:

1) import spacy 2) nlp = spacy.load("en_core_web_lg") 1) 导入 spacy 2) nlp = spacy.load("en_core_web_lg")

Does anyone know how to create a shortcut link to spacy using a conda command?有谁知道如何使用 conda 命令创建指向 spacy 的快捷链接? I am using Windows 10 and Python 3.8 btw.顺便说一句,我正在使用 Windows 10 和 Python 3.8。

Thanks!谢谢!

That's interesting.那很有意思。 If you really aim at using the model by means of spacy.load("en_core_web_lg") , you don't actually need to set the link.如果您真的spacy.load("en_core_web_lg")通过spacy.load("en_core_web_lg")使用模型,则实际上不需要设置链接。 See https://spacy.io/usage/models for some explanations.有关一些解释,请参阅https://spacy.io/usage/models

Other than that, you don't state why "the pip command does not work".除此之外,您没有说明“pip 命令不起作用”的原因。 This should be running pretty straight forward (explicitly using version 2.2.3 to avoid the model not being available, yet, for the newly released version 2.2.4):这应该非常直接地运行(明确使用版本 2.2.3 以避免模型不可用,但对于新发布的版本 2.2.4):

python3 -m pip install -Iv spacy==2.2.3
python3 -m spacy download en_core_web_lg
python3 -m spacy link en_core_web_lg en_default

With this, you should be ready to use the model by means of spacy.load("en_default") .有了这个,您应该准备好通过spacy.load("en_default")使用模型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM