从名词中获取口头名词

问题描述 投票:1回答:1

言语名词是由动词形成或对应于动词的名词。

我正在寻找一种算法,当给定一个名词时,该算法将返回相应的动词(如果输入名词是口头名词)。我最初的想法是将其作为词干应用于名词,然后在动词列表中搜索具有相同词干的动词。在执行此操作之前,我创建了一个小的测试数据集。它表明有时这种方法行不通:例如:“解释”和“解释”没有相同的词干。“决定”和“决定”没有相同的词干。

from nltk.stem.snowball import SnowballStemmer
stemmer = SnowballStemmer('english')

l=[('to increase', 'increase'),
('to inhibit', 'inhibition'),
('to activate', 'activation'),
  ('to explain', 'explanation'),
  ('to correlate', 'correlation'),
  ('to decide', 'decision'),
   ('to insert', 'insertion')
  ]

for p in l:
    print(stemmer.stem(p[0]), ' <-> ', stemmer.stem(p[1]))

#to increas  <->  increas
#to inhibit  <->  inhibit
#to activ  <->  activ
#to explain  <->  explan
#to correl  <->  correl
#to decid  <->  decis
#to insert  <->  insert

有人知道在所有情况下(或至少在更多情况下)都可以使用的方法吗?

nlp nltk text-processing linguistics
1个回答
0
投票

由于无法确定所有情况,所以没有一种在所有情况下都适用的解决方案。在英语中,任何名词都可以有效地“动词化”,从而产生了无限个集合。您可以做的是对标记进行词素化,然后使用nltk的lemma.derivationally_related_forms()函数来获取所有从动词派生的名词。搜索相应的数据结构将为您提供正确的结果。为了减少您必须为每个名词搜索的动词数量,您可以使用诸如最大的公共前缀之类的东西。 。

看看这个:

https://www.howtobuildsoftware.com/index.php/how-do/4EO/python-nlp-wordnet-get-noun-from-verb-wordnet

© www.soinside.com 2019 - 2024. All rights reserved.