在 Java 中将单词转换为名词/形容词/动词形式 [英] Convert words into their noun / adjective / verb form in Java
问题描述
是否有可能用 Java 替代 NLTK 来动词化",如在这个问题中所见?
例如我想将出生转换为出生,因为在使用 Wordnet Similarity 时,算法没有显示出生和出生非常相似.
因此,我想将出生转换为出生,反之亦然.为了有更多相似的词.
你有什么建议?我找到了一些工具,但我不确定他们是否可以做到这一点:- NTLK(我猜只有蟒蛇)- OpenNlp- 斯坦福-Nlp- 简单的 NLG
谢谢
使用 wordnet 的快速而肮脏的解决方案如下所示.
>>>from ntlk.corpus import wordnet as wn>>>wn.synsets('出生')[Synset('born.n.01'), Synset('bear.v.01'), Synset('give_birth.v.01'), Synset('digest.v.03'), Synset('bear.v.04'), Synset('bear.v.05'), Synset('bear.v.06'), Synset('hold.v.11'), Synset('yield.v.10'),Synset('wear.v.02'), Synset('behave.v.02'), Synset('bear.v.11'), Synset('hold.v.14'), Synset('have_a_bun_in_the_oven.v.01'), Synset('born.a.01'), Synset('natural.s.09')]>>>wn.synsets('出生')[Synset('birth.n.01'), Synset('birth.n.02'), Synset('parturition.n.01'), Synset('parentage.n.02'), Synset('birth.n.05'), Synset('give_birth.v.01')]>>>
在这里你可以看到Synset('give_birth.v.01')]"是一个常见的结果集,它是动词".所以通过这种方式你可以找到解决方法,看看是否有任何匹配的结果,并将出生转换为出生,反之亦然!
Is it possible to hava a Java alternative to NLTK in order to 'verbify' words as can be seen in this question?
Convert words between verb/noun/adjective forms
For example I would like to convert born to birth, since when using Wordnet Similarity, the algorithm does not show that born and birth are very similar.
I would like to therefore convert either born to birth or vice versa. In order to have much more similar words.
What do you suggest? I found some tools but I'm not sure if they can do this: - NTLK (only python I guess) - OpenNlp - Stanford-Nlp - Simple NLG
Thank you
A quick and dirty solution using wordnet can be like following.
>>>from ntlk.corpus import wordnet as wn
>>> wn.synsets('born')
[Synset('born.n.01'), Synset('bear.v.01'), Synset('give_birth.v.01'), Synset('digest.v.03'), Synset('bear.v.04'), Synset('bear.v.05'), Synset('bear.v.06'), Synset('hold.v.11'), Synset('yield.v.10'), Synset('wear.v.02'), Synset('behave.v.02'), Synset('bear.v.11'), Synset('hold.v.14'), Synset('have_a_bun_in_the_oven.v.01'), Synset('born.a.01'), Synset('natural.s.09')]
>>> wn.synsets('birth')
[Synset('birth.n.01'), Synset('birth.n.02'), Synset('parturition.n.01'), Synset('parentage.n.02'), Synset('birth.n.05'), Synset('give_birth.v.01')]
>>>
Here you can see that " Synset('give_birth.v.01')] " is a common result set which is "verb". So in this way you can find work around and see if there is any matching result, and convert born to birth or vice versa!
这篇关于在 Java 中将单词转换为名词/形容词/动词形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!