我怎样才能让 spacy 不产生 -PRON- 引理?

How can i make spacy not produce the -PRON- lemma?

我正在使用 spacy 来对大量推文进行词形还原。但是,当我对 "I" 这样的词进行词形还原时,会生成标记 -PRON-。我怎样才能避免这种情况?

-PRON- 是 spaCy 中代词的默认引理(参见 docs):

About spaCy's custom pronoun lemma

Unlike verbs and common nouns, there’s no clear base form of a personal pronoun. Should the lemma of “me” be “I”, or should we normalize person as well, giving “it” — or maybe “he”? spaCy’s solution is to introduce a novel symbol, -PRON-, which is used as the lemma for all personal pronouns.

如果您不想要它,您可以简单地将其替换为其他内容,例如相关标记的单词形式(请参阅下面的代码片段)。请注意,这可能会对后续处理产生意想不到的后果。 spaCy 同时使用字符串和整数表示令牌属性,因此您可能希望更改这两个(如果可能),或保留原始整数值以实现可追溯性。

if token.lemma_ == '-PRON-':
    token.lemma_ = token.orth_ # change the string representation
    token.lemma = token.orth # change the integer representation (I didn't test this part)