全部,
戰斗的基本形式是什么?詞形還原導致作戰,因為我認為它應該是戰斗。我對詞形還原的理解是錯誤的嗎?
from nltk import download
download('wordnet')
from nltk.stem.wordnet import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
def get_lemma(word):
return lemmatizer.lemmatize(word)
get_lemma('battling')
來到這個詞也是一樣

uj5u.com熱心網友回復:
默認的詞形還原pos(詞性)是該lemmatize方法的名詞。它產生輸出battling。
如果您將 the 更改pos為動詞,就像這里的情況一樣,您會得到正確的結果。
lemmatizer.lemmatize("battling", wordnet.VERB)
會給基礎 battle
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/392886.html
上一篇:如何從段落中提取日期
