我正在尝试使用 spacy 获取文档中所有标记的引理(即 token.lemma_)。
代码:
sentence = 'I'm looking for all of the lemmas. Please help me find them!' nlp = spacy.load('en', disable=['parser', 'NER]) doc = nlp(sentence) tokens = [tokens.lemma_ for token in doc]
预期结果:
['look', 'lemma', 'help', 'find']
实际结果:
[-PRON-, 'be', 'look', 'all', 'of', 'the', 'lemma', '.', 'please', 'help', '-PRON-', 'find', '-PRON', '!']
我是否缺少 spacy 中的某种预处理功能,或者我是否必须单独进行预处理?我希望在词形还原之前删除所有标点符号和停用词。
人到中年有点甜
相关分类