I am looping through various senses for certain words trying to find the nearest common parent for each sense pair. I am using the examples code line:
System.out.println("Common Parent Index: " + ((AsymmetricRelationship) list.get(0)).getCommonParentIndex());
to get it printed. However, with certain sense-pairs I get an exeption ending in:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
I noticed that the word sense-pairs that cause that exception do not have a common parent in the WordNet dictionary. For example if you try to get a common parent for the sense of animal, "dog", (the top-node of which is 'entity') with the 'seal' in the sense 'stamp affixed to a document' (the topnode of which is 'abstraction') the above error message is displayed.
To me it seems that this is a bug in JWNL, but I guess that there is a way of avoiding the above by using some other of the JWNL methods. My question is: How could I elicit the information through JWNL-API that the two senses have no common parents without getting to this error?
I managed to ignore the nodes with no common parents by putting my code within an iterator-loop that checks whether there is any content in the list. However, I feel, JWNL being an API this checking should probably be done in the JWNL code itself. The user should not worry about the structure and failings of the WordNet itself.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.