【问题标题】:Get all leaf words for a stemmed keyword获取词干关键字的所有叶词
【发布时间】:2021-01-11 23:41:48
【问题描述】:

我正在寻找类似 un-stemming 的东西。有没有办法获得所有可能的具有共同词干的单词列表。类似的东西

>>> get_leaf_words('play')
>>> ['player', 'play', 'playing' ... ]

【问题讨论】:

  • 来自什么数据?
  • @AntonPomieshchenko 我看到了这个.. 但是我正在寻找更通用的东西
  • @schwobaseggl 我正在寻找独立于域的东西。
  • 这通常是无限的,不是吗?

标签: python nlp nltk


【解决方案1】:

上述问题的解答:https://github.com/gutfeeling/word_forms!感谢@Divyanshu Srivastava

>>> from word_forms.word_forms import get_word_forms
>>> get_word_forms("president")
>>> {'n': {'presidents', 'presidentships', 'presidencies', 'presidentship', 'president', 'presidency'},
     'a': {'presidential'},
     'v': {'preside', 'presided', 'presiding', 'presides'},
     'r': {'presidentially'}}
>>> get_word_forms("elect")
>>> {'n': {'elects', 'electives', 'electors', 'elect', 'eligibilities', 'electorates', 'eligibility', 'elector', 'election', 'elections', 'electorate', 'elective'},
     'a': {'eligible', 'electoral', 'elective', 'elect'},
     'v': {'electing', 'elects', 'elected', 'elect'},
     'r': set()}


上一个答案:

反向词干提取是不可能的,因为大多数词干分析器使用应用于原始词的一些规则集来创建基本词。

但是有一种叫做实现(或“表面实现”)的崇高词形还原。

您可以使用一些公开的词形还原数据集/字典来做到这一点。

示例:https://raw.githubusercontent.com/richardwilly98/elasticsearch-opennlp-auto-tagging/master/src/main/resources/models/en-lemmatizer.dict [Apache OpenNLP]

我在 Python 中找不到直接库,但在 Java 中找到了一个 (pynlg)

此外:如果你有足够多的原始词,你可以创建一个反向词典来进行词形还原或词干提取!

【讨论】:

  • @Divyanshu 如果你发现了什么,请告诉我,我会在这里更新!这听起来像是一个有趣的问题,我将为此开发一个 python 库(但这可能需要时间)
  • 在 github 上找到此代码.. 这实际上是我想要的。 github.com/gutfeeling/word_forms
猜你喜欢
  • 2018-05-23
  • 2017-04-30
  • 2013-06-09
  • 1970-01-01
  • 1970-01-01
  • 2021-12-27
  • 2023-03-09
  • 1970-01-01
  • 2012-09-30
相关资源
最近更新 更多