尝试使用 wordnet java api 查找同义词

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13745631/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 13:51:21  来源:igfitidea点击:

Trying to find synonyms using wordnet java api

javawordnetsynonym

提问by missrg

I am trying to find synonyms of some words(String type) in java using Wordnet java api. I have difficulties though in figuring out how it works.

我正在尝试使用 Wordnet java api 在 java 中查找某些单词(字符串类型)的同义词。虽然我很难弄清楚它是如何工作的。

I found this link http://lyle.smu.edu/~tspell/jaws/doc/edu/smu/tspell/wordnet/impl/file/ReferenceSynset.html#getTagCount%28java.lang.String%29which I though it is useful, but still I don't know how to start. Do I have to create a ReferenceSynset object and then find its synonyms, and how can this be done? Or is there another easier way? Please help!

我发现这个链接http://lyle.smu.edu/~tspell/jaws/doc/edu/smu/tspell/wordnet/impl/file/ReferenceSynset.html#getTagCount%28java.lang.String%29我认为它很有用,但我仍然不知道如何开始。我是否必须创建一个 ReferenceSynset 对象,然后找到它的同义词,如何做到这一点?或者有其他更简单的方法吗?请帮忙!

Thanks in advance!

提前致谢!

回答by Ram Narasimhan

JAWS - "Java API for WordNet Searching"has been created exactly for this purpose. It is possible that you haven't installed it right. In the same domain that you mention (smu.edu) there are instructions for installing JAWS.

JAWS - “用于 WordNet 搜索的 Java API”正是为此目的而创建的。可能是你没有正确安装。在您提到的同一个域 (smu.edu) 中,有安装 JAWS 的说明。

First, you will need to download the executable and Wordnetitself.

首先,您需要下载可执行文件和Wordnet本身。

  1. Get the *.jar file
  2. Download the wordnet database files to the appropriate directory (instructions here)
  1. 获取 *.jar 文件
  2. 将 wordnet 数据库文件下载到适当的目录(此处有说明

Once you have done this you should next try the example program.First, make sure that it works unmodified. If you get that working, you should see a bunch of synsets when you type:

完成此操作后,接下来应该尝试示例程序。首先,确保它在未经修改的情况下工作。如果你成功了,你应该在你输入时看到一堆同义词:

java TestJAWS <your word here>

java TestJAWS <your word here>

If that works, you can start modifying the code to suit your purpose.

如果可行,您可以开始修改代码以适合您的目的。

Hope that helps.

希望有帮助。