edu.mit.jwi.item.IIndexWord Java Examples
The following examples show how to use
edu.mit.jwi.item.IIndexWord.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WordNet.java From senti-storm with Apache License 2.0 | 5 votes |
public boolean contains(String word) { for (POS pos : POS.values()) { for (String stem : m_wordnetStemmer.findStems(word, pos)) { IIndexWord indexWord = m_dict.getIndexWord(stem, pos); if (indexWord != null) return true; } } return false; }
Example #2
Source File: WordNet.java From senti-storm with Apache License 2.0 | 5 votes |
public synchronized POS findPOS(String word) { int maxCount = 0; POS mostLikelyPOS = null; for (POS pos : POS.values()) { // From JavaDoc: The surface form may or may not contain whitespace or // underscores, and may be in mixed case. word = word.replaceAll("\\s", "").replaceAll("_", ""); List<String> stems = m_wordnetStemmer.findStems(word, pos); for (String stem : stems) { IIndexWord indexWord = m_dict.getIndexWord(stem, pos); if (indexWord != null) { int count = 0; for (IWordID wordId : indexWord.getWordIDs()) { IWord aWord = m_dict.getWord(wordId); ISenseEntry senseEntry = m_dict.getSenseEntry(aWord.getSenseKey()); count += senseEntry.getTagCount(); } if (count > maxCount) { maxCount = count; mostLikelyPOS = pos; } } } } return mostLikelyPOS; }
Example #3
Source File: WordNetUtils.java From ADW with GNU General Public License v3.0 | 5 votes |
public List<IWord> getSenses(IIndexWord idxWord) { List<IWord> senses = new ArrayList<IWord>(); if (idxWord != null) { for (IWordID senseID : idxWord.getWordIDs()) senses.add(dictionary.getWord(senseID)); } return senses; }
Example #4
Source File: WordNetUtils.java From ADW with GNU General Public License v3.0 | 5 votes |
public Set<String> getAllWords(POS pos) { Set<String> words = new HashSet<String>(); Iterator<IIndexWord> i = dictionary.getIndexWordIterator(pos); while(i.hasNext()) { IIndexWord iw = (IIndexWord)i.next(); words.add(iw.getLemma()); } return words; }
Example #5
Source File: WordNetUtils.java From ADW with GNU General Public License v3.0 | 4 votes |
public IIndexWord getIndexWord(String word, POS pos) { return dictionary.getIndexWord(word, pos); }