When retrieving semantic relations of a Synset through MIT Java Wordnet Interface (JWI) I simply can't get derivationally related forms. I'm using the ISynset class method getRelatedSynsets(IPointer p)
, but the list simply returns empty.
As a simple test I developed a class that iterates all Noun Synsets of wordnet and tries to find any synset exposing a Derivationally related form. Surprisingly the code can't find a single synset with that relation. Here is the code:
public class DerivationallyTest {
private static IDictionary dict = null;
public static void main(String[] args) throws IOException {
IDictionary dict = dicitionaryFactory();
Iterator<ISynset> it = dict.getSynsetIterator(POS.NOUN);
while(it.hasNext()){
ISynset synset = it.next();
if(synset.getRelatedSynsets(Pointer.DERIVATIONALLY_RELATED).size() > 0){
System.out.println("FOUND ONE!!!");
}
}
}
public static IDictionary dicitionaryFactory() throws IOException{
if(dict == null){
System.out.println("Instanciando Dicionario...");
// construct the URL to the Wordnet dictionary directory
String wnhome = System.getenv("WNHOME");
String path = wnhome + File.separator + "dict";
URL url = new URL("file", null, path);
// construct the dictionary object and open it
dict = new Dictionary(url);
dict.open();
}
return dict;
}
}
Am I doing something wrong or is this an actual bizarre behavior? I have developed a lot of classes using MIT JWI already and wouldn't like to have to change to another API after som much work.
I'm using Wordnet 3.1 and MIT JWI 2.2.3 under Ubuntu 12 LTS
UPDATE: I also tried with Wordnet 3.0 and same thing happens.
Only semantic pointers attach to synsets. Lexical pointers only attach to words. Try: IWord.getRelatedWords(IPointer ptr)
http://projects.csail.mit.edu/jwi/api/edu/mit/jwi/item/ISynset.html#getRelatedSynsets(edu.mit.jwi.item.IPointer)