Trying to find synonyms using wordnet java api

missrg picture missrg · Dec 6, 2012 · Viewed 12.4k times · Source

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.

I found this link http://lyle.smu.edu/~tspell/jaws/doc/edu/smu/tspell/wordnet/impl/file/ReferenceSynset.html#getTagCount%28java.lang.String%29 which 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!

Thanks in advance!

Answer

Ram Narasimhan picture Ram Narasimhan · Dec 10, 2012

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.

First, you will need to download the executable and Wordnet itself.

  1. Get the *.jar file
  2. Download the wordnet database files to the appropriate directory (instructions here)

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>

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

Hope that helps.