/** * Ctor * @param synset * @param word * @throws WordNetException */ public JwiSensedWord(JwiSynset synset, String word) throws WordNetException { this.synset = synset; this.word = word; String wordToLookup = word.replace(' ', '_'); // mimic jwnl, which replaces underscores with spaces when looking up IWord iWord = null; boolean found = false; for (int i = 1; i <= synset.realSynset.getWords().size() && !found; i++) { iWord = synset.realSynset.getWord(i); found = iWord.getLemma().equalsIgnoreCase(wordToLookup); } if (!found) throw new WordNetException("\""+ word + "\" is not a memeber of the given synset " + synset); this.iWord = iWord; dictionary = synset.jwiDictionary; this.pos = JwiUtils.getWordNetPartOfSpeech(iWord.getPOS()); }
public String getOffsetFromIWord(String senseKey) { IWord sense = getSenseFromSenseKey(senseKey); return fixOffset(sense.getSynset().getOffset(), sense.getPOS()); }
public SemSig getSemSigFromIWord(IWord sense, LKB lkb, int size) { String offset = GeneralUtils.fixOffset(sense.getSynset().getOffset(),sense.getPOS()); return getSemSigFromOffset(offset, lkb, size); }
public String getOffsetFromWordSense(String wordSense) { IWord sense = mapWordSenseToIWord(wordSense); return fixOffset(sense.getSynset().getOffset(), sense.getPOS()); }
/** * Ctor with an {@link IWord} and a {@link JwiDictionary} * This Ctor is quicker than the other. * @param jwiDictionary */ JwiSensedWord(IWord iWord, JwiDictionary jwiDictionary) { this.iWord = iWord; this.synset = new JwiSynset(jwiDictionary, iWord.getSynset()); this.word = iWord.getLemma(); this.dictionary = jwiDictionary; this.pos = JwiUtils.getWordNetPartOfSpeech(iWord.getPOS()); }
public SemSig getSemSigFromWordSense(String wordSense, LKB lkb, int size) { IWord sense = WordNetUtils.getInstance().mapWordSenseToIWord(wordSense); String offset = GeneralUtils.fixOffset(sense.getSynset().getOffset(),sense.getPOS()); return getSemSigFromOffset(offset, lkb, size); }