Tabnine Logo
IndexWord.getSenses
Code IndexAdd Tabnine to your IDE (free)

How to use
getSenses
method
in
net.sf.extjwnl.data.IndexWord

Best Java code snippets using net.sf.extjwnl.data.IndexWord.getSenses (Showing top 20 results out of 315)

origin: hltfbk/Excitement-Open-Platform

protected Set<Synset> indexWordToSet(IndexWord indexWord) throws JWNLException
{
  Set<Synset> ret = new LinkedHashSet<Synset>();
  if (indexWord!=null)
  {
    for (net.sf.extjwnl.data.Synset jwnlRealSynset : indexWord.getSenses())
    {
      ret.add(new ExtJwnlSynset(this, jwnlRealSynset));
    }
  }
  return ret;
}

origin: extjwnl/extjwnl

/**
 * Finds out how many senses the word with part-of-speech <var>pos</var> has.
 *
 * @param pos POS
 * @return number of senses the word with part-of-speech <var>pos</var> has
 */
public int getSenseCount(POS pos) {
  int result = 0;
  IndexWord indexWord = getIndexWord(pos);
  if (null != indexWord) {
    result = indexWord.getSenses().size();
  }
  return result;
}
origin: net.sf.extjwnl/extjwnl-utilities

private static boolean hasUseCount(final IndexWord iw) {
  for (final Synset synset : iw.getSenses()) {
    for (final Word word : synset.getWords()) {
      if (0 < word.getUseCount()) {
        return true;
      }
    }
  }
  return false;
}
origin: extjwnl/extjwnl

private static boolean hasPointer(final IndexWord iw, final PointerType pointerType) {
  for (final Synset synset : iw.getSenses()) {
    for (final Pointer pointer : synset.getPointers()) {
      if (pointerType == pointer.getType()) {
        return true;
      }
    }
  }
  return false;
}
origin: net.sf.extjwnl/extjwnl-utilities

private static boolean hasPointer(final IndexWord iw, final PointerType pointerType) {
  for (final Synset synset : iw.getSenses()) {
    for (final Pointer pointer : synset.getPointers()) {
      if (pointerType == pointer.getType()) {
        return true;
      }
    }
  }
  return false;
}
origin: net.sf.extjwnl/extjwnl-utilities

private void demonstrateListOperation(IndexWord word) throws JWNLException {
  // Get all of the hypernyms (parents) of the first sense of <var>word</var>
  PointerTargetNodeList hypernyms = PointerUtils.getDirectHypernyms(word.getSenses().get(0));
  System.out.println("Direct hypernyms of \"" + word.getLemma() + "\":");
  hypernyms.print();
}
origin: net.sf.extjwnl/extjwnl-utilities

private void demonstrateTreeOperation(IndexWord word) throws JWNLException {
  // Get all the hyponyms (children) of the first sense of <var>word</var>
  PointerTargetTree hyponyms = PointerUtils.getHyponymTree(word.getSenses().get(0));
  System.out.println("Hyponyms of \"" + word.getLemma() + "\":");
  hyponyms.print();
}
origin: extjwnl/extjwnl

private void demonstrateTreeOperation(IndexWord word) throws JWNLException {
  // Get all the hyponyms (children) of the first sense of <var>word</var>
  PointerTargetTree hyponyms = PointerUtils.getHyponymTree(word.getSenses().get(0));
  System.out.println("Hyponyms of \"" + word.getLemma() + "\":");
  hyponyms.print();
}
origin: extjwnl/extjwnl

private void demonstrateListOperation(IndexWord word) throws JWNLException {
  // Get all of the hypernyms (parents) of the first sense of <var>word</var>
  PointerTargetNodeList hypernyms = PointerUtils.getDirectHypernyms(word.getSenses().get(0));
  System.out.println("Direct hypernyms of \"" + word.getLemma() + "\":");
  hypernyms.print();
}
origin: extjwnl/extjwnl

private static boolean hasUseCount(final IndexWord iw) {
  for (final Synset synset : iw.getSenses()) {
    for (final Word word : synset.getWords()) {
      if (0 < word.getUseCount()) {
        return true;
      }
    }
  }
  return false;
}
origin: extjwnl/extjwnl

  private void demonstrateSymmetricRelationshipOperation(IndexWord start, IndexWord end) throws JWNLException, CloneNotSupportedException {
    // find all synonyms that <var>start</var> and <var>end</var> have in common
    RelationshipList list = RelationshipFinder.findRelationships(start.getSenses().get(0), end.getSenses().get(0), PointerType.SIMILAR_TO);
    System.out.println("Synonym relationship between \"" + start.getLemma() + "\" and \"" + end.getLemma() + "\":");
    for (Object aList : list) {
      ((Relationship) aList).getNodeList().print();
    }
    System.out.println("Depth: " + list.get(0).getDepth());
  }
}
origin: lucene4ir/lucene4ir

public static Set<String> getSynonyms(String word) throws JWNLException {
  IndexWord[] allWords = getWordArray(word);
  if (allWords.length == 1) {
    Set<String> retData = new HashSet<>();
    for (Synset synset : allWords[0].getSenses()) {
      for (Word wordObj : synset.getWords()) {
        retData.add(wordObj.getLemma());
      }
    }
    return retData;
  }
  return null;
}
origin: net.sf.extjwnl/extjwnl-utilities

  private void demonstrateSymmetricRelationshipOperation(IndexWord start, IndexWord end) throws JWNLException, CloneNotSupportedException {
    // find all synonyms that <var>start</var> and <var>end</var> have in common
    RelationshipList list = RelationshipFinder.findRelationships(start.getSenses().get(0), end.getSenses().get(0), PointerType.SIMILAR_TO);
    System.out.println("Synonym relationship between \"" + start.getLemma() + "\" and \"" + end.getLemma() + "\":");
    for (Object aList : list) {
      ((Relationship) aList).getNodeList().print();
    }
    System.out.println("Depth: " + list.get(0).getDepth());
  }
}
origin: extjwnl/extjwnl

private void demonstrateAsymmetricRelationshipOperation(IndexWord start, IndexWord end) throws JWNLException, CloneNotSupportedException {
  // Try to find a relationship between the first sense of <var>start</var> and the first sense of <var>end</var>
  RelationshipList list = RelationshipFinder.findRelationships(start.getSenses().get(0), end.getSenses().get(0), PointerType.HYPERNYM);
  System.out.println("Hypernym relationship between \"" + start.getLemma() + "\" and \"" + end.getLemma() + "\":");
  for (Object aList : list) {
    ((Relationship) aList).getNodeList().print();
  }
  System.out.println("Common Parent Index: " + ((AsymmetricRelationship) list.get(0)).getCommonParentIndex());
  System.out.println("Depth: " + list.get(0).getDepth());
}
origin: net.sf.extjwnl/extjwnl-utilities

private void demonstrateAsymmetricRelationshipOperation(IndexWord start, IndexWord end) throws JWNLException, CloneNotSupportedException {
  // Try to find a relationship between the first sense of <var>start</var> and the first sense of <var>end</var>
  RelationshipList list = RelationshipFinder.findRelationships(start.getSenses().get(0), end.getSenses().get(0), PointerType.HYPERNYM);
  System.out.println("Hypernym relationship between \"" + start.getLemma() + "\" and \"" + end.getLemma() + "\":");
  for (Object aList : list) {
    ((Relationship) aList).getNodeList().print();
  }
  System.out.println("Common Parent Index: " + ((AsymmetricRelationship) list.get(0)).getCommonParentIndex());
  System.out.println("Depth: " + list.get(0).getDepth());
}
origin: extjwnl/extjwnl

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;
}
origin: net.sf.extjwnl/extjwnl-utilities

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;
}
origin: net.sf.extjwnl/extjwnl

private void removeThisSynsetFromIndexWords(Word word) {
  if (null != dictionary && dictionary.isEditable()) {
    try {
      IndexWord indexWord = dictionary.getIndexWord(getPOS(), word.getLemma());
      if (null != indexWord) {
        indexWord.getSenses().remove(Synset.this);
      }
    } catch (JWNLException e) {
      throw new JWNLRuntimeException(e);
    }
  }
}
origin: extjwnl/extjwnl

private void removeThisSynsetFromIndexWords(Word word) {
  if (null != dictionary && dictionary.isEditable()) {
    try {
      IndexWord indexWord = dictionary.getIndexWord(getPOS(), word.getLemma());
      if (null != indexWord) {
        indexWord.getSenses().remove(Synset.this);
      }
    } catch (JWNLException e) {
      throw new JWNLRuntimeException(e);
    }
  }
}
origin: apache/opennlp-sandbox

public List<Synset> getSynsets() {
 try {
  return Dictionary.getDefaultResourceInstance()
    .lookupIndexWord(WSDHelper.getPOS(this.getTargetTag()),
      this.getTargetWord())
    .getSenses();
 } catch (JWNLException e) {
  e.printStackTrace();
 }
 return null;
}
net.sf.extjwnl.dataIndexWordgetSenses

Javadoc

Returns the senses of this word.

Popular methods of IndexWord

  • getLemma
    Return the word's lemma. Its lemma is its orthographic representation, for example "dog" or "get up"
  • getPOS
    Returns the word's part-of-speech.
  • getSynsetOffsets
  • <init>
  • getKey
    Returns the lemma of this word.
  • getUseCount
  • setDictionary
  • sortSenses
    Sorts senses according to their use count.
  • toString

Popular in Java

  • Start an intent from android
  • getSharedPreferences (Context)
  • findViewById (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Reference (javax.naming)
  • JList (javax.swing)
  • JOptionPane (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now