[E050] Can‘t find model ‘en‘. It doesn‘t seem to be a shortcut link,

OSError: [E050] 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.

在这里插入图片描述
去Git下载:en_core_web_sm

https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.0/en_core_web_sm-2.3.0.tar.gz

然后pip install刚刚的包

import spacy
print(spacy.load('en_core_web_sm'))
from torchtext.legacy.data import Field, NestedField, LabelField
# from torchtext import data

CHAR_NESTING = Field(tokenize=list, lower=True)
char_field = NestedField(CHAR_NESTING, tokenize='spacy', fix_length=tcfig.pad_size, tokenizer_language='en_core_web_sm')
word_field = Field(tokenize='spacy', lower=True, include_lengths=True, fix_length=tcfig.pad_size, tokenizer_language='en_core_web_sm')
label_field = LabelField(dtype=torch.long)

https://blog.csdn.net/qq_42363032/article/details/126929995?spm=1001.2014.3001.5501

猜你喜欢

转载自blog.csdn.net/qq_42363032/article/details/126929405