public String toString() { if (_cachedToString == null) { String str = ""; if (size() == 0) { str = JWNL.resolveMessage("DATA_TOSTRING_003"); } else { StringBuffer buf = new StringBuffer(); Iterator itr = getValidPOSSet().iterator(); while (itr.hasNext()) { buf.append(getIndexWord((POS)itr.next()).toString()); } str = buf.toString(); } _cachedToString = JWNL.resolveMessage("DATA_TOSTRING_004", str); } return _cachedToString; }
/** * It is assumed that IndexWordSets will only be created by calling * {@link net.didion.jwnl.dictionary.Dictionary#lookupAllIndexWords Dictionary.lookupAllIndexWords}, * so all IndexWordSets with the same lemma should be equal. */ public boolean equals(Object object) { return (object instanceof IndexWordSet) && getLemma().equals(((IndexWordSet)object).getLemma()); } }
IndexWordSet set = new IndexWordSet(lemma); for (Iterator itr = POS.getAllPOS().iterator(); itr.hasNext();) { IndexWord current = lookupIndexWord((POS)itr.next(), lemma); if (current != null) set.add(current);
public void getAllIndexWords(String word){ allIndexWords.clear(); IndexWord[] iWordArr = null; IndexWord iWord = null; try { IndexWordSet iWordSet = wDict.lookupAllIndexWords(word); if(iWordSet != null){ iWordArr = iWordSet.getIndexWordArray(); for(int i=0;i<iWordArr.length;i++){ iWord = iWordArr[i]; //System.out.println("indexWord:"+iWord.getLemma()); allIndexWords.add(iWord); } } } catch (Exception e) { //System.out.println("getSynonym ERROR: " + word); } }
/** Find out how many senses the word with part-of-speech <code>pos</code> has. */ public int getSenseCount(POS pos) { return getIndexWord(pos).getSenseCount(); }
/** * Return a set of <code>IndexWord</code>s, with each element in the set * corresponding to a part-of-speech of <var>word</var>. * @param lemma the word for which to lookup senses * @return An array of IndexWords, each of which is a sense of <var>word</var> */ public IndexWordSet lookupAllIndexWords(String lemma) throws JWNLException { lemma = prepareQueryString(lemma); IndexWordSet set = new IndexWordSet(lemma); for (Iterator itr = POS.getAllPOS().iterator(); itr.hasNext();) { IndexWord current = lookupIndexWord((POS)itr.next(), lemma); if (current != null) set.add(current); } return set; } }
public synchronized POS[] getPOS(String s) throws JWNLException { // Look up all IndexWords (an IndexWord can only be one POS) IndexWordSet set = wordnet.lookupAllIndexWords(s); // Turn it into an array of IndexWords IndexWord[] words = set.getIndexWordArray(); // Make the array of POS POS[] pos = new POS[words.length]; for (int i = 0; i < words.length; i++) { pos[i] = words[i].getPOS(); } return pos; }
public Map<WordNetPartOfSpeech, List<Synset>> getSortedSynsetOf(String lemma) throws WordNetException { Map<WordNetPartOfSpeech, List<Synset>> ret = new HashMap<WordNetPartOfSpeech, List<Synset>>(); if (doNotProcessThisWord(lemma)) ; else { try { net.didion.jwnl.data.IndexWordSet indexWordSet = jwnlRealDictionary.lookupAllIndexWords(lemma); if (indexWordSet!=null) { for (WordNetPartOfSpeech partOfSpeech : WordNetPartOfSpeech.values()) { net.didion.jwnl.data.POS pos = JwnlUtils.getJwnlPartOfSpeec(partOfSpeech); if (indexWordSet.getIndexWord(pos)!=null) ret.put(partOfSpeech, indexWordToList(indexWordSet.getIndexWord(pos))); } } } catch(JWNLException e) { throw new WordNetException("looking for lemma <"+lemma+"> failed. See nested exception",e); } } return ret; }
public synchronized POS[] getPOS(String s) throws JWNLException { // Look up all IndexWords (an IndexWord can only be one POS) IndexWordSet set = wordnet.lookupAllIndexWords(s); // Turn it into an array of IndexWords IndexWord[] words = set.getIndexWordArray(); // Make the array of POS POS[] pos = new POS[words.length]; for (int i = 0; i < words.length; i++) { pos[i] = words[i].getPOS(); } return pos; }
if (indexWordSet.getIndexWord(pos)!=null) ret.put(partOfSpeech, indexWordToSet(indexWordSet.getIndexWord(pos)));