java - 将复数名词转换为单数 NLP

标签 java python nlp

我有一个复数名词列表。比如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/

相关文章:

java - 是否可以基于输入文件创建 Java 枚举?

java - 如何在第二个屏幕上使用 GUI 启动 jar 文件

java - 关于 POJO 的问题!

java - 某些同等条件不起作用

python - 将数据从一个 .exe 传递到另一个

python - 从 NLTK 格式分块斯坦福命名实体识别器 (NER) 输出

python - 标记停用词生成的标记 ['ha' , 'le' , 'u' , 'wa' ] 不在 stop_words

python - 单调递增数的数量

python - 在 Python 中将类型定义为 (1) 序列 (2) 可迭代类型的确切规范是什么?

python - 提供您自己的自定义标签来标记 nltk 中的数据?