使用 wordnet 获取单词的引理
如何使用 Wordnet 获取给定单词的引理。我似乎无法在 wordnet 文档中找到我想要的内容。 http://wordnet.princeton.edu/wordnet/man/wn.1WN.html
例如,对于“books”这个词,我想得到“book”,ashes =>灰烬,预订=>书,苹果=>苹果....等
我想在命令行中使用 wordnet 来实现这一点,但我找不到检索这种情况的确切选项。
php 解决方案也会有很大帮助,因为我最初打算使用 wordnet php API,但他们网站上的当前 API 似乎无法正常工作。
How can I get the lemma for a given word using Wordnet. I couldn't seem to find in the wordnet documentation what i want. http://wordnet.princeton.edu/wordnet/man/wn.1WN.html
For example for the word "books" i want to get "book" , ashes => ash , booking => book, apples => apple .... etc.
i want to achieve this using wordnet in command line and I cant find exact options to retrieve such case.
A php solution would also be of great help because I originally intend to use the wordnet php API but it seems the current one in their website isn't working.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Morphy 是 WordNet 原生的形态处理器。 WordNet 接口调用 Morphy 来对单词进行词形还原,作为查找过程的一部分(例如,您查询“enlightened”,它会返回“enlightened”的结果,并通过 Morphy 返回“enlighten”的结果)。
这些界面不包含允许用户直接访问 Morphy 的功能,因此只有当您使用 WordNet API 之一编写自己的程序时才能在命令行中使用它。您可以在 WordNet 站点上找到 Morphy 的文档。
据我所知,PHP 接口仍然可用,尽管您可能需要使用 WordNet 2 .x。
Morphy is a morphological processor native to WordNet. The WordNet interfaces invoke Morphy to lemmatize a word as part of the lookup process (e.g. you query "enlightened", it returns the results for both "enlightened" and, via Morphy, "enlighten").
The interfaces don't include a feature that allows a user to directly access Morphy, so using it in command line is only possible if you write your own program using one of the WordNet APIs. You can find documentation for Morphy at the WordNet site.
As near as I can tell, the PHP interface is still available, although you may need to use WordNet 2.x.
如果您可以使用其他工具,请尝试 TreeTagger。
If you can use another tool try TreeTagger.
我不确定 WordNet 本身是否实现了它。 NLTK 有 Morphy,它完全可以满足您的需求,但它是用 Python 实现的。您可以编写一个小型 Python 程序来从命令行获取输入并返回引理。
在以下链接中搜索“Morphy”:
http://nltk.googlecode .com/svn/trunk/doc/api/nltk.corpus.reader.wordnet.WordNetCorpusReader-class.html
nltk.WordNetLemmatizer() 也可以完成这项工作。在以下链接中搜索“词形还原”:
http://nltk.googlecode.com/svn/trunk/doc/book /ch03.html
NLTK 网站:http://www.nltk.org/
I am not sure that WordNet implements it natively. NLTK has Morphy, which precisely does what you want, but it is implemented in Python though. You can write a small Python program to take input from the command line and return the lemma.
Search for 'Morphy' in the following link:
http://nltk.googlecode.com/svn/trunk/doc/api/nltk.corpus.reader.wordnet.WordNetCorpusReader-class.html
nltk.WordNetLemmatizer() also does the job. Search for 'Lemmatization' in the following link:
http://nltk.googlecode.com/svn/trunk/doc/book/ch03.html
NLTK website : http://www.nltk.org/
nltk 库中的 WordNetLemmatizer 将满足您的需要。这是 python3 代码:
从命令行运行:
The WordNetLemmatizer in the nltk library will do what you need. here is python3 code:
Running this from the command line: