如何找到一个词根的所有相关关键词? [英] How to find all the related keywords for a root word?
问题描述
我试图找出一种方法来查找来自同一个词根的所有关键字(从某种意义上说是词干的相反动作).目前,我正在使用 R 进行编码,但如果有帮助,我愿意切换到其他语言.
I am trying to figure out a way to find all the keywords that come from the same root word (in some sense the opposite action of stemming). Currently, I am using R for coding, but I am open to switching to a different language if it helps.
例如,我有词根rent",我希望能够找到renting"、renter"、rental"、rents"等.
For instance, I have the root word "rent" and I would like to be able to find "renting", "renter", "rental", "rents" and so on.
推荐答案
在 python 中试试这个代码:
from pattern.en import lexeme
print(lexeme("rent")
生成的输出是:
安装:
pip 安装模式
pip 安装 nltk
现在,打开一个终端,输入 python 并运行以下代码.
the output generated is:
Installation:
pip install pattern
pip install nltk
Now, open a terminal, type python and run the below code.
import nltk
nltk.download(["wordnet","wordnet_ic","sentiwordnet"])
安装完成后,再次运行模式代码.
After the installation is done, run the pattern code again.
这篇关于如何找到一个词根的所有相关关键词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!