当我使用 SpaCy 来识别停用词时,如果我使用en_core_web_lg语料库它不起作用,但是当我使用en_core_web_sm. 这是一个错误,还是我做错了什么?
import spacy
nlp = spacy.load('en_core_web_lg')
doc = nlp(u'The cat ran over the hill and to my lap')
for word in doc:
print(f' {word} | {word.is_stop}')
结果:
The | False
cat | False
ran | False
over | False
the | False
hill | False
and | False
to | False
my | False
lap | False
但是,当我更改此行以使用en_core_web_sm语料库时,会得到不同的结果:
nlp = spacy.load('en_core_web_sm')
The | False
cat | False
ran | False
over | True
the | True
hill | False
and | True
to | True
my | True
lap | False
湖上湖
相关分类