Package net.didion.jwnl.data

Examples of net.didion.jwnl.data.IndexWord


   *            POS tag of the word
   */
  public static String[] SynsetWords(String word, POS posw) {
    try {
      java.util.ArrayList<String> res = new java.util.ArrayList<String>();
      IndexWord iw = Dictionary.getInstance().lookupIndexWord(
          getPOS(posw), word);
      Synset[] synsets = iw.getSenses();
      for (Synset ss : synsets) {
        Word[] words = ss.getWords();
        for (Word w : words)
          res.add(w.getLemma());
      }
View Full Code Here


    try {
      // Get all of the hypernyms (parents) of the first sense of
      // <var>word</var>
      java.util.HashSet<String> res = new java.util.HashSet<String>();

      IndexWord iw = Dictionary.getInstance().lookupIndexWord(
          getPOS(pos), word);
      PointerTargetNodeList hypernyms = PointerUtils.getInstance()
          .getDirectHypernyms(iw.getSense(1));
      for (int i = 0; i < hypernyms.size(); i++) {
        PointerTargetNode ptn = (PointerTargetNode) hypernyms.get(i);
        Word[] words = ptn.getSynset().getWords();
        for (Word w : words)
          res.add(w.getLemma());
View Full Code Here

    try {
      // Get all of the hypernyms (parents) of the first sense of
      // <var>word</var>
      java.util.HashSet<String> res = new java.util.HashSet<String>();

      IndexWord iw = Dictionary.getInstance().lookupIndexWord(
          getPOS(pos), word);
      PointerTargetTree hyponyms = PointerUtils.getInstance()
          .getHyponymTree(iw.getSense(1));
      @SuppressWarnings("unchecked")
      List<PointerTargetNodeList> list = hyponyms.toList();
      for (int i = 0; i < list.size(); i++) {
        PointerTargetNodeList ptnl = (PointerTargetNodeList) list
            .get(i);
View Full Code Here

  }

  private static int distance(String w1, POS pos1, String w2, POS pos2,
      PointerType type) {
    try {
      IndexWord start = Dictionary.getInstance().lookupIndexWord(
          getPOS(pos1), w1);
      IndexWord end = Dictionary.getInstance().lookupIndexWord(
          getPOS(pos2), w2);

      if ((start == null) || (end == null))
        return Integer.MAX_VALUE;

      Synset startSynset = start.getSense(1);
      Synset endSynset = end.getSense(1);

      RelationshipList list = RelationshipFinder.getInstance()
          .findRelationships(startSynset, endSynset, type);
      // System.out.println("Synonym relationship between \"" +
      // start.getLemma() + "\" and \"" + end.getLemma() + "\":");
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.