/** * Returns sense number of this word (1-based) or 0 if not found. * sense_number is a decimal integer indicating the sense number of the word, * within the part of speech encoded in sense_key, in the WordNet database. * * @return sense number or 0 if not found * @throws JWNLException JWNLException */ public int getSenseNumber() throws JWNLException { int result = 0; if (null != dictionary) { IndexWord indexWord = dictionary.getIndexWord(getPOS(), lemma); if (null != indexWord) { result = indexWord.getSenses().indexOf(synset) + 1; } } return result; }
/** * Returns sense number of this word (1-based) or 0 if not found. * sense_number is a decimal integer indicating the sense number of the word, * within the part of speech encoded in sense_key, in the WordNet database. * * @return sense number or 0 if not found * @throws JWNLException JWNLException */ public int getSenseNumber() throws JWNLException { int result = 0; if (null != dictionary) { IndexWord indexWord = dictionary.getIndexWord(getPOS(), lemma); if (null != indexWord) { result = indexWord.getSenses().indexOf(synset) + 1; } } return result; }
public void setSynonyms() { for (Word word : synset.getWords()) synonyms.add(new WordPOS(word.toString(), word.getPOS())); }
private void addToIndexWords(Word word) { if (null != dictionary && dictionary.isEditable()) { try { IndexWord iw = dictionary.getIndexWord(word.getPOS(), word.getLemma()); if (null == iw) { dictionary.createIndexWord(word.getPOS(), word.getLemma(), Synset.this); } else { if (!iw.getSenses().contains(Synset.this)) { iw.getSenses().add(Synset.this); } } } catch (JWNLException e) { throw new JWNLRuntimeException(e); } } } }
private void addToIndexWords(Word word) { if (null != dictionary && dictionary.isEditable()) { try { IndexWord iw = dictionary.getIndexWord(word.getPOS(), word.getLemma()); if (null == iw) { dictionary.createIndexWord(word.getPOS(), word.getLemma(), Synset.this); } else { if (!iw.getSenses().contains(Synset.this)) { iw.getSenses().add(Synset.this); } } } catch (JWNLException e) { throw new JWNLRuntimeException(e); } } } }
/** * Ctor that takes a synset and a word. It verifies that the word indeed belongs to the synset. * <p> * <b>NOTE</b> ExtJwnl <i>lowercases</i> the words it is queried about. But the words it retrieves in methods like <code>realSynset.getWords()</code> * are case sensitive! * * @param synset * @param strWord * @throws WordNetException */ public ExtJwnlSensedWord(ExtJwnlSynset synset, String strWord) throws WordNetException { this.synset = synset; this.word = strWord; String wordToLookup = strWord.replace(' ', '_'); // mimic jwnl, which replaces underscores with spaces when looking up List<Word> words = synset.realSynset.getWords(); Word wordObj = lookupWordInWords(words, wordToLookup); if (wordObj == null) throw new WordNetException("\""+ strWord + "\" is not a memeber of the given synset " + synset); this.wordObj = wordObj; dictionary = synset.extJwnlDictionary; this.pos = ExtJwnlUtils.getWordNetPartOfSpeech( wordObj.getPOS()); }
public String toString() { return ResourceBundleSet.insertParams("[Word: {0} [Lemma: {1}] {2} [Index: {3}]]", new Object[]{getPOS(), getLemma(), getSynset(), getIndex()}); }
public String toString() { return ResourceBundleSet.insertParams("[Word: {0} [Lemma: {1}] {2} [Index: {3}]]", new Object[]{getPOS(), getLemma(), getSynset(), getIndex()}); }
private static int getSenseNo(final Word word) throws JWNLException { final IndexWord iw = word.getDictionary().getIndexWord(word.getPOS(), word.getLemma()); for (int i = 0; i < iw.getSenses().size(); i++) { if (iw.getSenses().get(i).getOffset() == word.getSynset().getOffset()) { return i; } } return -1; }
private static int getSenseNo(final Word word) throws JWNLException { final IndexWord iw = word.getDictionary().getIndexWord(word.getPOS(), word.getLemma()); for (int i = 0; i < iw.getSenses().size(); i++) { if (iw.getSenses().get(i).getOffset() == word.getSynset().getOffset()) { return i; } } return -1; }
protected int getSynsetType() { int ss_type = getPOS().getId(); if (POS.ADJECTIVE == getSynset().getPOS() && getSynset().isAdjectiveCluster()) { ss_type = POS.ADJECTIVE_SATELLITE_ID; } return ss_type; }
protected int getSynsetType() { int ss_type = getPOS().getId(); if (POS.ADJECTIVE == getSynset().getPOS() && getSynset().isAdjectiveCluster()) { ss_type = POS.ADJECTIVE_SATELLITE_ID; } return ss_type; }
/** * Ctor with an {@link Word} and a dictionary * This Ctor is quicker than the other. * @param jwiDictionary * @throws WordNetException */ ExtJwnlSensedWord(Word wordObj, ExtJwnlDictionary extJwnlDictionary) throws WordNetException { if (wordObj==null) throw new WordNetException("wordObj is null!"); this.wordObj = wordObj; this.synset = new ExtJwnlSynset(extJwnlDictionary, wordObj.getSynset()); this.word = wordObj.getLemma(); this.dictionary = extJwnlDictionary; this.pos = ExtJwnlUtils.getWordNetPartOfSpeech( wordObj.getPOS()); }
public CachedSense(String senseId) throws SenseInventoryException { super(senseId); try { word = wn.getWordBySenseKey(senseId); synset = word.getSynset(); pos = wordNetPosToSiPos.transform(word.getPOS()); useCount = word.getUseCount(); } catch (JWNLException e) { throw new SenseInventoryException(e); } }
if(!posSet){ lexicalEntry.setPartOfSpeech(WNConvUtil.getPOS(lexeme.getPOS())); posSet = true;