我有一个复数名词列表。比如apples, oranges等等。我想把它们都变成单数名词。有没有用于此目的的工具?最好是 Java 或 Python。
最佳答案
例如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))
输出:
('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')
来源:
关于java - 将复数名词转换为单数 NLP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33972717/