@Test public void testGetBestSynonyms() { assertTrue(WordNet.INSTANCE.getBestSynonyms(POS.VERB, "learn").contains("acquire")); }
public List<String> getBestSynonyms(POS pos, String s) { List<String> synonyms = new ArrayList<String>(); IIndexWord iw = dict.getIndexWord(s,pos); if(iw != null) { IWordID wordID = iw.getWordIDs().get(0); IWord word = dict.getWord(wordID); ISynset synset = word.getSynset () ; for ( IWord w : synset.getWords () ) { String c = w.getLemma(); if (!c.equals(s) && !c.contains(" ") && synonyms.size() < 4) {synonyms.add(c);} } } return synonyms; }
WordNet { public List<String> getBestSynonyms(POS pos, String s) { List<String> synonyms = new ArrayList<String>(); IIndexWord iw = dict.getIndexWord(s,pos); if(iw != null) { IWordID wordID = iw.getWordIDs().get(0); IWord word = dict.getWord(wordID); ISynset synset = word.getSynset () ; for ( IWord w : synset.getWords () ) { String c = w.getLemma(); if (!c.equals(s) && !c.contains(" ") && synonyms.size() < 4) {synonyms.add(c);} } } return synonyms; } }
WordNet { public List<String> getBestSynonyms(POS pos, String s) { List<String> synonyms = new ArrayList<String>(); IIndexWord iw = dict.getIndexWord(s,pos); if(iw != null) { IWordID wordID = iw.getWordIDs().get(0); IWord word = dict.getWord(wordID); ISynset synset = word.getSynset () ; for ( IWord w : synset.getWords () ) { String c = w.getLemma(); if (!c.equals(s) && !c.contains(" ") && synonyms.size() < 4) {synonyms.add(c);} } } return synonyms; } private  WordNet(); }
WordNet { public List<String> getBestSynonyms(POS pos, String s) { List<String> synonyms = new ArrayList<String>(); IIndexWord iw = dict.getIndexWord(s,pos); if(iw != null) { IWordID wordID = iw.getWordIDs().get(0); IWord word = dict.getWord(wordID); ISynset synset = word.getSynset () ; for ( IWord w : synset.getWords () ) { String c = w.getLemma(); if (!c.equals(s) && !c.contains(" ") && synonyms.size() < 4) {synonyms.add(c);} } } return synonyms; } private  WordNet(); List<String> getBestSynonyms(POS pos, String s); List<String> getAttributes(String s); List<String> getRelatedNouns(String s); }
WordNet { public List<String> getBestSynonyms(POS pos, String s) { List<String> synonyms = new ArrayList<String>(); IIndexWord iw = dict.getIndexWord(s,pos); if(iw != null) { IWordID wordID = iw.getWordIDs().get(0); IWord word = dict.getWord(wordID); ISynset synset = word.getSynset () ; for ( IWord w : synset.getWords () ) { String c = w.getLemma(); if (!c.equals(s) && !c.contains(" ") && synonyms.size() < 4) {synonyms.add(c);} } } return synonyms; } private  WordNet(); List<String> getBestSynonyms(POS pos, String s); List<String> getAttributes(String s); List<String> getRelatedNouns(String s); static final WordNet INSTANCE; public IDictionary dict; }