Codota Logo
IndexWord
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain IndexWord
private void myMethod () {
IndexWord i =
  • Codota IconDictionary dictionary;POS pos;String lemma;dictionary.getIndexWord(pos, lemma)
  • Smart code suggestions by Codota
}
origin: net.sf.extjwnl/extjwnl

/**
 * Looks whether the target word is one of the words in one of the synsets
 * of the source word.
 *
 * @param sourceWord source word
 * @param targetWord target word
 * @return int the sense of the source word that contains the target word
 */
public static int getImmediateRelationship(IndexWord sourceWord, IndexWord targetWord) {
  List<Synset> senses = sourceWord.getSenses();
  String lemma = targetWord.getLemma();
  for (int i = 0; i < senses.size(); i++) {
    if (senses.get(i).containsWord(lemma)) {
      return i + 1;
    }
  }
  return -1;
}
origin: extjwnl/extjwnl

/**
 * Returns true if the lemma and the part of speech both match.
 */
public boolean equals(Object object) {
  return (object instanceof IndexWord)
      && ((IndexWord) object).getLemma().equals(getLemma()) && ((IndexWord) object).getPOS().equals(getPOS());
}
origin: extjwnl/extjwnl

  private void writeObject(java.io.ObjectOutputStream oos) throws IOException {
    boolean synsetOffsetsNull = (null == synsetOffsets);
    synsetOffsets = getSynsetOffsets();
    oos.defaultWriteObject();
    if (synsetOffsetsNull) {
      synsetOffsets = null;
    }
  }
}
origin: net.sf.extjwnl/extjwnl

@Override
public void removeIndexWord(IndexWord indexWord) throws JWNLException {
  getTable(indexWord.getPOS(), DictionaryFileType.INDEX).remove(indexWord.getKey());
  super.removeIndexWord(indexWord);
}
origin: hltfbk/Excitement-Open-Platform

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

origin: net.sf.extjwnl/extjwnl

private void renderIndexWord(IndexWord indexWord, StringBuilder result) {
  ArrayList<PointerType> pointerTypes = new ArrayList<>();
  for (Synset synset : indexWord.getSenses()) {
    for (Pointer pointer : synset.getPointers()) {
      if ((pointer.getSource() instanceof Word) && !indexWord.getLemma().equals(((Word) pointer.getSource()).getLemma().toLowerCase())) {
        continue;
  int tagSenseCnt = indexWord.sortSenses();
  result.append(indexWord.getLemma().replace(' ', '_'));
  result.append(' ');
  result.append(indexWord.getPOS().getKey()).append(' '); // pos
  result.append(indexWord.getSenses().size()).append(' '); // synset_cnt
  result.append(pointerTypes.size()).append(' '); // p_cnt
  for (PointerType pointerType : pointerTypes) {
  result.append(indexWord.getSenses().size()).append(' '); // sense_cnt
  for (Synset synset : indexWord.getSenses()) {
    formatOffset(synset.getOffset(), offsetLength, result);
    result.append(' '); // synset_offset
origin: net.sf.extjwnl/extjwnl-utilities

  System.out.println("\nNo information available for " + pos.getLabel() + " " + key);
} else {
  System.out.println("\nInformation available for " + iw.getPOS().getLabel() + " " + iw.getLemma());
  printAvailableInfo(iw);
        iw = d.getIndexWord(pos, form);
        if (null != iw) {
          System.out.println("\nInformation available for " + iw.getPOS().getLabel() + " " + iw.getLemma());
          printAvailableInfo(iw);
  final IndexWord iw = d.lookupIndexWord(p, key);
  if (iw != null) {
    System.out.println("\nAntonyms of " + (p == null ? "" : p.getLabel()) + " " + iw.getLemma());
    tracePointers(iw, PointerType.ANTONYM, 1, needSense, needGloss, needLex, needOffset, needSenseNum, needSenseKeys);
  final IndexWord iw = d.lookupIndexWord(p, key);
  if (null != iw) {
    System.out.println("\nHypernyms of " + (p == null ? "" : p.getLabel()) + " " + iw.getLemma());
    tracePointers(iw, PointerType.HYPERNYM, PointerUtils.INFINITY, needSense, needGloss, needLex, needOffset, needSenseNum, needSenseKeys);
  final IndexWord iw = d.lookupIndexWord(p, key);
  if (null != iw) {
    System.out.println("\nHyponyms of " + (p == null ? "" : p.getLabel()) + " " + iw.getLemma());
    tracePointers(iw, PointerType.HYPONYM, 1, needSense, needGloss, needLex, needOffset, needSenseNum, needSenseKeys);
  final IndexWord iw = d.lookupIndexWord(p, key);
  if (null != iw) {
    System.out.println("\nHyponyms of " + (p == null ? "" : p.getLabel()) + " " + iw.getLemma());
    tracePointers(iw, PointerType.HYPONYM, PointerUtils.INFINITY, needSense, needGloss, needLex, needOffset, needSenseNum, needSenseKeys);
origin: net.sf.extjwnl/extjwnl

/**
 * Removes <var>indexWord</var> from the dictionary.
 *
 * @param indexWord index word to remove
 * @throws JWNLException JWNLException
 */
public synchronized void removeIndexWord(IndexWord indexWord) throws JWNLException {
  checkEditable();
  indexWord.setDictionary(null);
  // take care of words in synsets
  List<Synset> copy = new ArrayList<>(indexWord.getSenses());
  for (Synset synset : copy) {
    List<Word> wordsCopy = new ArrayList<>(synset.getWords());
    for (Word word : wordsCopy) {
      if (word.getLemma().equalsIgnoreCase(indexWord.getLemma())) {
        synset.getWords().remove(word);
        break;
      }
    }
  }
}
origin: net.sf.extjwnl/extjwnl

int result = 0;
if (1 < getSenses().size()) {
  List<Synset> ucSenses = new ArrayList<>(getSenses().size());
  List<Synset> nonUCSenses = new ArrayList<>(getSenses().size());
  for (Synset synset : getSenses()) {
    if (0 < getUseCount(synset, lemma)) {
      ucSenses.add(synset);
    } else {
  ucSenses.sort(Collections.reverseOrder(Comparator.comparingInt(o -> getUseCount(o, lemma))));
  if (POS.ADJECTIVE == getPOS()) {
    int i = 0;
    while (i < nonUCSenses.size()) {
} else if (1 == getSenses().size()) {
  if (0 < getUseCount(getSenses().get(0), lemma)) {
    result = 1;
origin: net.sf.extjwnl/extjwnl

public IndexWord next() {
  if (hasNext()) {
    IndexWord thisWord = startWord;
    startWord = null;
    while (itr.hasNext()) {
      IndexWord word = itr.next();
      if (word.getLemma().contains(searchString)) {
        startWord = word;
        break;
      }
    }
    return thisWord;
  } else {
    throw new NoSuchElementException();
  }
}
origin: net.sf.extjwnl/extjwnl-utilities

int id = nextId();
iwStmt.setInt(1, id);
iwStmt.setString(2, iw.getLemma());
iwStmt.setString(3, iw.getPOS().getKey());
iwStmt.addBatch();
idToSynsetOffset.put(id, iw.getSynsetOffsets());
origin: net.sf.extjwnl/extjwnl

/**
 * Adds an IndexWord to this set.
 *
 * @param word word to add
 */
public void add(IndexWord word) {
  indexWords.put(word.getPOS(), word);
}
origin: net.sf.extjwnl/extjwnl

public IndexWord createIndexWord(POS pos, String lemma, Synset synset) throws JWNLException {
  return new IndexWord(dictionary, lemma, pos, synset);
}
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

private void renderIndexWord(IndexWord indexWord, StringBuilder result) {
  ArrayList<PointerType> pointerTypes = new ArrayList<>();
  for (Synset synset : indexWord.getSenses()) {
    for (Pointer pointer : synset.getPointers()) {
      if ((pointer.getSource() instanceof Word) && !indexWord.getLemma().equals(((Word) pointer.getSource()).getLemma().toLowerCase())) {
        continue;
  int tagSenseCnt = indexWord.sortSenses();
  result.append(indexWord.getLemma().replace(' ', '_'));
  result.append(' ');
  result.append(indexWord.getPOS().getKey()).append(' '); // pos
  result.append(indexWord.getSenses().size()).append(' '); // synset_cnt
  result.append(pointerTypes.size()).append(' '); // p_cnt
  for (PointerType pointerType : pointerTypes) {
  result.append(indexWord.getSenses().size()).append(' '); // sense_cnt
  for (Synset synset : indexWord.getSenses()) {
    formatOffset(synset.getOffset(), offsetLength, result);
    result.append(' '); // synset_offset
origin: extjwnl/extjwnl

  System.out.println("\nNo information available for " + pos.getLabel() + " " + key);
} else {
  System.out.println("\nInformation available for " + iw.getPOS().getLabel() + " " + iw.getLemma());
  printAvailableInfo(iw);
        iw = d.getIndexWord(pos, form);
        if (null != iw) {
          System.out.println("\nInformation available for " + iw.getPOS().getLabel() + " " + iw.getLemma());
          printAvailableInfo(iw);
  final IndexWord iw = d.lookupIndexWord(p, key);
  if (iw != null) {
    System.out.println("\nAntonyms of " + (p == null ? "" : p.getLabel()) + " " + iw.getLemma());
    tracePointers(iw, PointerType.ANTONYM, 1, needSense, needGloss, needLex, needOffset, needSenseNum, needSenseKeys);
  final IndexWord iw = d.lookupIndexWord(p, key);
  if (null != iw) {
    System.out.println("\nHypernyms of " + (p == null ? "" : p.getLabel()) + " " + iw.getLemma());
    tracePointers(iw, PointerType.HYPERNYM, PointerUtils.INFINITY, needSense, needGloss, needLex, needOffset, needSenseNum, needSenseKeys);
  final IndexWord iw = d.lookupIndexWord(p, key);
  if (null != iw) {
    System.out.println("\nHyponyms of " + (p == null ? "" : p.getLabel()) + " " + iw.getLemma());
    tracePointers(iw, PointerType.HYPONYM, 1, needSense, needGloss, needLex, needOffset, needSenseNum, needSenseKeys);
  final IndexWord iw = d.lookupIndexWord(p, key);
  if (null != iw) {
    System.out.println("\nHyponyms of " + (p == null ? "" : p.getLabel()) + " " + iw.getLemma());
    tracePointers(iw, PointerType.HYPONYM, PointerUtils.INFINITY, needSense, needGloss, needLex, needOffset, needSenseNum, needSenseKeys);
origin: extjwnl/extjwnl

/**
 * Removes <var>indexWord</var> from the dictionary.
 *
 * @param indexWord index word to remove
 * @throws JWNLException JWNLException
 */
public synchronized void removeIndexWord(IndexWord indexWord) throws JWNLException {
  checkEditable();
  indexWord.setDictionary(null);
  // take care of words in synsets
  List<Synset> copy = new ArrayList<>(indexWord.getSenses());
  for (Synset synset : copy) {
    List<Word> wordsCopy = new ArrayList<>(synset.getWords());
    for (Word word : wordsCopy) {
      if (word.getLemma().equalsIgnoreCase(indexWord.getLemma())) {
        synset.getWords().remove(word);
        break;
      }
    }
  }
}
origin: extjwnl/extjwnl

int result = 0;
if (1 < getSenses().size()) {
  List<Synset> ucSenses = new ArrayList<>(getSenses().size());
  List<Synset> nonUCSenses = new ArrayList<>(getSenses().size());
  for (Synset synset : getSenses()) {
    if (0 < getUseCount(synset, lemma)) {
      ucSenses.add(synset);
    } else {
  ucSenses.sort(Collections.reverseOrder(Comparator.comparingInt(o -> getUseCount(o, lemma))));
  if (POS.ADJECTIVE == getPOS()) {
    int i = 0;
    while (i < nonUCSenses.size()) {
} else if (1 == getSenses().size()) {
  if (0 < getUseCount(getSenses().get(0), lemma)) {
    result = 1;
origin: extjwnl/extjwnl

public IndexWord next() {
  if (hasNext()) {
    IndexWord thisWord = startWord;
    startWord = null;
    while (itr.hasNext()) {
      IndexWord word = itr.next();
      if (word.getLemma().contains(searchString)) {
        startWord = word;
        break;
      }
    }
    return thisWord;
  } else {
    throw new NoSuchElementException();
  }
}
origin: extjwnl/extjwnl

int id = nextId();
iwStmt.setInt(1, id);
iwStmt.setString(2, iw.getLemma());
iwStmt.setString(3, iw.getPOS().getKey());
iwStmt.addBatch();
idToSynsetOffset.put(id, iw.getSynsetOffsets());
net.sf.extjwnl.dataIndexWord

Javadoc

An IndexWord represents a line of the pos.index file. An IndexWord is created or retrieved via Dictionary#lookupIndexWord.

Most used methods

  • getSenses
    Returns the senses of this word.
  • 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

  • Updating database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • requestLocationUpdates (LocationManager)
  • findViewById (Activity)
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JFrame (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now