I am searching for a way to find all the synonyms of a particular word using wordnet. I am using JAWS.
For example:
love(v):
How about using RitaWN instead of JAWS? I see it is listed as one of the available API in http://wordnet.princeton.edu/wordnet/related-projects/#Java
I also see it has getAllSynonyms()
method, they provide an example and it works.
Check this out:
import java.io.IOException;
import java.util.Arrays;
import rita.*;
public class Synonyms {
public static void main(String[] args) throws IOException {
// Would pass in a PApplet normally, but we don't need to here
RiWordNet wordnet = new RiWordNet("C:\\Program Files (x86)\\WordNet\\2.1");
// Get a random noun
String word = "love";//wordnet.getRandomWord("n");
// Get max 15 synonyms
String[] synonyms = wordnet.getAllSynonyms(word, "v");
System.out.println("Random noun: " + word);
if (synonyms != null) {
// Sort alphabetically
Arrays.sort(synonyms);
for (int i = 0; i < synonyms.length; i++) {
System.out.println("Synonym " + i + ": " + synonyms[i]);
}
} else {
System.out.println("No synyonyms!");
}
}
Make sure to get the latest downloads and documentation from http://www.rednoise.org/rita/wordnet-old/documentation/index.htm