Package net.didion.jwnl.data

Examples of net.didion.jwnl.data.IndexWord


        Vector<String> result = new Vector<String>();
        IndexWordSet words;
        try {
            words = WNLookup.getDict().lookupAllIndexWords(baseWord);
            Iterator iter = words.getIndexWordCollection().iterator();
            IndexWord word;
            while (iter.hasNext()) {
                word = (IndexWord) iter.next();
                if (word != null) {
                    // result.add(getWordLabel(word));
                    // for all senses...
                    for (int c = 0; c < word.getSenses().length; c++) {
                        // all hypernyms for the synset:
                        PointerTargetNodeList hypernyms = PointerUtils
                                .getInstance()
                                .getAntonyms(word.getSense(c + 1));
                        result.addAll(getLemmata(hypernyms));
                    }
                }

            }
View Full Code Here


        Vector<String> result = new Vector<String>();
        IndexWordSet words;
        try {
            words = WNLookup.getDict().lookupAllIndexWords(baseWord);
            Iterator iter = words.getIndexWordCollection().iterator();
            IndexWord word;
            while (iter.hasNext()) {
                word = (IndexWord) iter.next();
                if (word != null) {
                    // result.add(getWordLabel(word));
                    // for all senses...
                    for (int c = 0; c < word.getSenses().length; c++) {
                        // all hypernyms for the synset:
                        PointerTargetNodeList hypernyms = PointerUtils
                                .getInstance().getCoordinateTerms(
                                        word.getSense(c + 1));
                        result.addAll(getLemmata(hypernyms));
                    }
                }

            }
View Full Code Here

        Vector<String> result = new Vector<String>();
        IndexWordSet words;
        try {
            words = WNLookup.getDict().lookupAllIndexWords(baseWord);
            Iterator iter = words.getIndexWordCollection().iterator();
            IndexWord word;
            while (iter.hasNext()) {
                word = (IndexWord) iter.next();
                if (word != null) {
                    // result.add(getWordLabel(word));
                    // for all senses...
                    for (int c = 0; c < word.getSenses().length; c++) {
                        // all hypernyms for the synset:
                        PointerTargetNodeList hypernyms = PointerUtils
                                .getInstance()
                                .getMeronyms(word.getSense(c + 1));
                        result.addAll(getLemmata(hypernyms));
                    }
                }

            }
View Full Code Here

        Vector<String> result = new Vector<String>();
        IndexWordSet words;
        try {
            words = WNLookup.getDict().lookupAllIndexWords(baseWord);
            Iterator iter = words.getIndexWordCollection().iterator();
            IndexWord word;
            while (iter.hasNext()) {
                word = (IndexWord) iter.next();
                if (word != null) {
                    // result.add(getWordLabel(word));
                    // for all senses...
                    for (int c = 0; c < word.getSenses().length; c++) {
                        // all hypernyms for the synset:
                        PointerTargetNodeList hypernyms = PointerUtils
                                .getInstance()
                                .getHolonyms(word.getSense(c + 1));
                        result.addAll(getLemmata(hypernyms));
                    }
                }

            }
View Full Code Here

    int count = 0;
    do {
      if (!itr.hasNext()) {
        break;
      }
      IndexWord iw = (IndexWord) itr.next();
      int id = nextId();
      iwStmt.setInt(1, id);
      iwStmt.setString(2, iw.getLemma());
      iwStmt.setString(3, iw.getPOS().getKey());
      iwStmt.execute();
      idToSynsetOffset.put(new Integer(id), iw.getSynsetOffsets());
      if (count++ % 1000 == 0)
        System.out.println(count);
    } while (true);
  }
View Full Code Here

  }

  @Override
  public String getSenseKey(String lemma, String pos, int sense) {
    try {
      IndexWord iw = dict.getIndexWord(POS.NOUN, lemma);
      if (iw == null) {
        return null;
      }
      return String.valueOf(iw.getSynsetOffsets()[sense]);
    } catch (JWNLException e) {
      e.printStackTrace();
      return null;
    }
View Full Code Here

  }

  @Override
  public int getNumSenses(String lemma, String pos) {
    try {
      IndexWord iw = dict.getIndexWord(POS.NOUN, lemma);
      if (iw == null) {
        return 0;
      }
      return iw.getSenseCount();
    } catch (JWNLException e) {
      return 0;
    }
  }
View Full Code Here

  }

  @Override
  public String[] getParentSenseKeys(String lemma, String pos, int sense) {
    try {
      IndexWord iw = dict.getIndexWord(POS.NOUN, lemma);
      if (iw != null) {
        Synset synset = iw.getSense(sense + 1);
        List<String> parents = new ArrayList<String>();
        getParents(synset, parents);
        return parents.toArray(new String[parents.size()]);
      } else {
        return empty;
View Full Code Here

    // extract verb
    Verb verb = searchFrame.getVerb();

    // choose lemma
    IndexWord iw = Dictionary.getInstance().lookupIndexWord(
        net.didion.jwnl.data.POS.VERB, verb.text);
    System.out.println("lemma : " + iw.getLemma());
    System.out.println("senses : " + iw.getSenseCount());
    String verbLemma = iw.getLemma();

    // find verb interpretation
    File verbnetDir = new File("verbnet-3.1");
    if (!verbnetDir.exists()) {
      throw new IllegalStateException("Non trovo verbnet : ["
View Full Code Here

   * @param pos2
   *            POS tag of word 2
   */
  public static boolean sameSynset(String w1, POS pos1, String w2, POS pos2) {
    try {
      IndexWord start = Dictionary.getInstance().lookupIndexWord(
          getPOS(pos1), w1);
      IndexWord end = Dictionary.getInstance().lookupIndexWord(
          getPOS(pos2), w2);
      if ((start == null) || (end == null))
        return false;
      int INMEDIATEdistance = RelationshipFinder.getInstance()
          .getImmediateRelationship(start, end);
View Full Code Here

TOP

Related Classes of net.didion.jwnl.data.IndexWord

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.