将复数名词转换为单数 NLP

edw*_*win 4 python java nlp

我有一个复数名词列表。例如,苹果,橙子等。我想将它们全部转换为单数名词。是否有任何工具可用于此目的?最好是 Java 或 Python。

Mar*_*cka 6

例如有https://pypi.python.org/pypi/inflect库。

例子:

import inflect
p = inflect.engine()

words = ["apples", "sheep", "oranges", "cats", "people", "dice", "pence"]

for word in words:
    print("The singular of ", word, " is ", p.singular_noun(word))
Run Code Online (Sandbox Code Playgroud)

输出:

('The singular of ', 'apples', ' is ', 'apple')
('The singular of ', 'sheep', ' is ', 'sheep')
('The singular of ', 'oranges', ' is ', 'orange')
('The singular of ', 'cats', ' is ', 'cat')
('The singular of ', 'people', ' is ', 'person')
('The singular of ', 'dice', ' is ', 'die')
('The singular of ', 'pence', ' is ', 'pence')
Run Code Online (Sandbox Code Playgroud)

资料来源: