git clone https://github.com/clips/pattern
cd pattern
git fetch
git checkout development
pip install mysqlclient
python setup.py install
那么
from pattern.en import conjugate, lemma, lexeme,PRESENT,SG
print (lemma('gave'))
print (lexeme('gave'))
print (conjugate(verb='give',tense=PRESENT,number=SG)) # he / she / it
收益率
give
['give', 'gives', 'giving', 'gave', 'given']
gives
from nltk.stem.wordnet import WordNetLemmatizer
words = ['gave','went','going','dating']
for word in words:
print word+"-->"+WordNetLemmatizer().lemmatize(word,'v')
对于Python3:
那么
收益率
感谢@Agargara为他们美丽的作品指点图案的作者,去支持他们;-)
在NLTK的帮助下,也可以做到这一点。它可以给出动词的基本形式。但不是确切的时态,但它仍然是有用的。请尝试以下代码。
输出为:
看看堆栈溢出问题。
相关问题 更多 >
编程相关推荐