public synchronized Synset[] getAllSenses(String word, POS pos) throws JWNLException { IndexWord iw = getIndexWord(pos, word); if (iw == null) return new Synset[0]; else return iw.getSenses(); }
public synchronized Synset[] getAllSenses(String word, POS pos) throws JWNLException { IndexWord iw = getIndexWord(pos, word); if (iw == null) return new Synset[0]; else return iw.getSenses(); }
protected Set<Synset> indexWordToSet(net.didion.jwnl.data.IndexWord indexWord) throws JWNLException { Set<Synset> ret = new HashSet<Synset>(); if (indexWord!=null) { for (net.didion.jwnl.data.Synset jwnlRealSynset : indexWord.getSenses()) { ret.add(new JwnlSynset(this, jwnlRealSynset)); } } return ret; }
public void getAllSenses(String word){ getAllIndexWords(word); allSenses.clear(); Iterator<IndexWord> itr = allIndexWords.iterator(); IndexWord iWord = null; while(itr.hasNext()){ iWord = itr.next(); try { Synset[] senses = iWord.getSenses(); for(int i=0;i<senses.length;i++) allSenses.add(senses[i]); } catch (Exception e) { //System.out.println("getSynonym ERROR: " + word); } } }
public synchronized List<String> getSynsets(String word, POS pos, boolean firstOnly) throws JWNLException { List<String> syns = new ArrayList<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return syns; for (Synset synset : indexWord.getSenses()) { syns.add(synset.getKey().toString()); if (firstOnly) break; } return syns; }
public synchronized List<String> getGlosses(String word, POS pos, boolean firstOnly) throws JWNLException { List<String> glosses = new ArrayList<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return glosses; for (Synset synset : indexWord.getSenses()) { glosses.add(synset.getGloss()); if (firstOnly) break; } return glosses; }
public synchronized List<String> getGlosses(String word, POS pos, boolean firstOnly) throws JWNLException { List<String> glosses = new ArrayList<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return glosses; for (Synset synset : indexWord.getSenses()) { glosses.add(synset.getGloss()); if (firstOnly) break; } return glosses; }
public synchronized List<String> getSynsets(String word, POS pos, boolean firstOnly) throws JWNLException { List<String> syns = new ArrayList<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return syns; for (Synset synset : indexWord.getSenses()) { syns.add(synset.getKey().toString()); if (firstOnly) break; } return syns; }
public synchronized List<String> getLexicographerFileNames(String word, POS pos, boolean firstOnly) throws JWNLException { List<String> names = new ArrayList<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return names; for (Synset synset : indexWord.getSenses()) { names.add(synset.getLexFileName()); if (firstOnly) break; } return names; }
/** * List of all verb frames associated with the word */ public synchronized Set<String> getVerbFrames(String word, boolean firstOnly) throws JWNLException { Set<String> verbFrames = new LinkedHashSet<>(); IndexWord indexWord = getIndexWord(POS.VERB, word); if (indexWord == null) return verbFrames; for (Synset synset : indexWord.getSenses()) { verbFrames.addAll(Arrays.asList(synset.getVerbFrames())); if (firstOnly) break; } return verbFrames; }
public synchronized List<String> getLexicographerFileNames(String word, POS pos, boolean firstOnly) throws JWNLException { List<String> names = new ArrayList<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return names; for (Synset synset : indexWord.getSenses()) { names.add(synset.getLexFileName()); if (firstOnly) break; } return names; }
/** * List of all verb frames associated with the word */ public synchronized Set<String> getVerbFrames(String word, boolean firstOnly) throws JWNLException { Set<String> verbFrames = new LinkedHashSet<>(); IndexWord indexWord = getIndexWord(POS.VERB, word); if (indexWord == null) return verbFrames; for (Synset synset : indexWord.getSenses()) { verbFrames.addAll(Arrays.asList(synset.getVerbFrames())); if (firstOnly) break; } return verbFrames; }
public synchronized List<Synset> getRelated(String word, POS pos, PointerType type, boolean firstOnly) throws JWNLException { List<Synset> output = new ArrayList<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return output; for (Synset synset : indexWord.getSenses()) { Pointer[] pointers = synset.getPointers(type); for (Pointer p : pointers) { output.add(p.getTargetSynset()); } if (firstOnly) break; } return output; }
public synchronized List<String> getSynonyms(String word, POS pos, boolean firstOnly) throws JWNLException { List<String> syns = new ArrayList<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return syns; for (Synset synset : indexWord.getSenses()) { for (Word w : synset.getWords()) { syns.add(w.getLemma()); } if (firstOnly) break; } return syns; }
public synchronized List<Synset> getRelated(String word, POS pos, PointerType type, boolean firstOnly) throws JWNLException { List<Synset> output = new ArrayList<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return output; for (Synset synset : indexWord.getSenses()) { Pointer[] pointers = synset.getPointers(type); for (Pointer p : pointers) { output.add(p.getTargetSynset()); } if (firstOnly) break; } return output; }
public synchronized List<String> getSynonyms(String word, POS pos, boolean firstOnly) throws JWNLException { List<String> syns = new ArrayList<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return syns; for (Synset synset : indexWord.getSenses()) { for (Word w : synset.getWords()) { syns.add(w.getLemma()); } if (firstOnly) break; } return syns; }
/** * Looks at whether the target word is one of the words in one of the synsets * of the source word. * @return int the sense of the source word that contains the target word */ public int getImmediateRelationship(IndexWord sourceWord, IndexWord targetWord) throws JWNLException { Synset[] senses = sourceWord.getSenses(); String lemma = targetWord.getLemma(); for (int i = 0; i < senses.length; i++) { if (senses[i].containsWord(lemma)) { return i + 1; } } return -1; }
public synchronized Set<String> getPointers(String word, POS pos, boolean firstOnly) throws JWNLException { Set<String> pointers = new LinkedHashSet<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return pointers; for (Synset synset : indexWord.getSenses()) { for (Pointer p : synset.getPointers()) { pointers.add(p.getType().getLabel()); } if (firstOnly) break; } return pointers; }
public List<String> getSisterTerms(POS pos, String s) { List<String> sisterTerms = new ArrayList<>(); try { IndexWord iw = dict.getIndexWord(pos, s);//dict.getMorphologicalProcessor().lookupBaseForm(pos, s) // IndexWord iw = dict.getMorphologicalProcessor().lookupBaseForm(pos, s); if (iw != null) { Synset[] synsets = iw.getSenses(); //System.out.println(synsets[0]); PointerTarget[] pointerArr = synsets[0].getTargets(); } } catch (JWNLException e) { e.printStackTrace(); } return sisterTerms; }
public synchronized Set<String> getPointers(String word, POS pos, boolean firstOnly) throws JWNLException { Set<String> pointers = new LinkedHashSet<>(); IndexWord indexWord = getIndexWord(pos, word); if (indexWord == null) return pointers; for (Synset synset : indexWord.getSenses()) { for (Pointer p : synset.getPointers()) { pointers.add(p.getType().getLabel()); } if (firstOnly) break; } return pointers; }