Search code examples
javarwordnet

Getting attributes from wordnet


From an article I read that It is possible to find whether a word has attributes or not by using WordNet. For example the word size has attributes – big, small similarly the word quality has attributes: inferior, superior etc. Can anyone please tell me how to do it in java(java or R)? . Thanks in Advance.


Solution

  • In Wordnet there are links between words (well, to be precise, between synsets). One of those possible links is the "attribute" link. So you can see here how the first meaning of the word size has two attribute links, one to the adjective large, and another to the adjective small:

    http://wordnetweb.princeton.edu/perl/webwn?o2=1&o0=1&o8=1&o1=1&o7=1&o5=1&o9=&o6=1&o3=1&o4=1&s=size&i=2&h=1000000000001000#c

    To get this information with the Java API, you use the getAttributes() function of a noun synset. So first use search to get the noun synset for the first meaning of the word "size", then call getAttributes() on it, and iterate through those. (The R wordnet API appears to be a wrapper around the java API, so it should be the same idea.)