getType in wordnet java API
I am using wordnet java API. I have defin开发者_开发百科ed a
WordNetDatabase database = WordNetDatabase.getFileInstance();
Synset[] synsets = database.getSynsets(wordForm);
System.out.println("type " + synsets[i].getType());
when I do this print, I get value 1 for "new york".
I am trying to find the value is NOUN (or) Verb.... But I get this values as 1. what does 1 stand for?
It says here is of type: SynsetType.
Please let me now how I can find if the given word I give to lookup and the response is a noun (or) verb..
EDIT: This time I misread the documentation :) I suggest using this:
SynsetType type = synsets[i].getType();
if (type.equals(SynsetType.NOUN)) {
// Code for nouns
} else if (type.equals(SynsetType.VERB) {
// Code for verbs
} else {
// Code for non-verb/nouns.
}
精彩评论