Package edu.mit.jwi.item

Examples of edu.mit.jwi.item.IIndexWord


    POS pos = POS.getPartOfSpeech(posTag.charAt(0));
    if(pos == null) {
      return synonyms;
    }
   
    IIndexWord iIndexWord = iDictionary.getIndexWord(word, pos);
    if(iIndexWord == null) {
      return synonyms; // no senses found
    }
   
    // iterate over senses
    for(IWordID iWordId : iIndexWord.getWordIDs()) {
      IWord iWord = iDictionary.getWord(iWordId);

      ISynset iSynset = iWord.getSynset();
      for(IWord synsetMember : iSynset.getWords()) {
        synonyms.add(synsetMember.getLemma());
View Full Code Here


    POS pos = POS.getPartOfSpeech(posTag.charAt(0));
    if(pos == null) {
      return hypernyms;
    }
   
    IIndexWord iIndexWord = dict.getIndexWord(word, pos);
    if(iIndexWord == null) {
      return hypernyms; // no senses found
    }
   
    // iterate over senses
    for(IWordID iWordId : iIndexWord.getWordIDs()) {
      IWord iWord1 = dict.getWord(iWordId);
      ISynset iSynset = iWord1.getSynset();
     
      // multiple hypernym chains are possible for a synset
      for(ISynsetID iSynsetId : iSynset.getRelatedSynsets(Pointer.HYPERNYM)) {
View Full Code Here

    POS pos = POS.getPartOfSpeech(posTag.charAt(0));
    if(pos == null) {
      return hypernyms;
    }
   
    IIndexWord iIndexWord = dict.getIndexWord(word, pos);
    if(iIndexWord == null) {
      return hypernyms; // no senses found
    }
   
    // iterate over senses
    for(IWordID iWordId : iIndexWord.getWordIDs()) {
      IWord iWord1 = dict.getWord(iWordId);
      ISynset iSynset = iWord1.getSynset();
     
      for(ISynsetID iSynsetId1 : iSynset.getRelatedSynsets(Pointer.HYPERNYM)) {
        for(ISynsetID iSynsetId2 : dict.getSynset(iSynsetId1).getRelatedSynsets(Pointer.HYPERNYM)) {
View Full Code Here

    POS pos = POS.getPartOfSpeech(posTag.charAt(0));
    if(pos == null) {
      return synonyms;
    }
   
    IIndexWord iIndexWord = iDictionary.getIndexWord(word, pos);
    if(iIndexWord == null) {
      return synonyms; // no senses found
    }
   
    // iterate over senses
    for(IWordID iWordId : iIndexWord.getWordIDs()) {
      IWord iWord = iDictionary.getWord(iWordId);

      ISynset iSynset = iWord.getSynset();
      for(IWord synsetMember : iSynset.getWords()) {
        synonyms.add(synsetMember.getLemma());
View Full Code Here

    POS pos = POS.getPartOfSpeech(posTag.charAt(0));
    if(pos == null) {
      return hypernyms;
    }
   
    IIndexWord iIndexWord = dict.getIndexWord(word, pos);
    if(iIndexWord == null) {
      return hypernyms; // no senses found
    }
   
    // iterate over senses
    for(IWordID iWordId : iIndexWord.getWordIDs()) {
      IWord iWord1 = dict.getWord(iWordId);
      ISynset iSynset = iWord1.getSynset();
     
      // multiple hypernym chains are possible for a synset
      for(ISynsetID iSynsetId : iSynset.getRelatedSynsets(Pointer.HYPERNYM)) {
View Full Code Here

    POS pos = POS.getPartOfSpeech(posTag.charAt(0));
    if(pos == null) {
      return hypernyms;
    }
   
    IIndexWord iIndexWord = dict.getIndexWord(word, pos);
    if(iIndexWord == null) {
      return hypernyms; // no senses found
    }
   
    // iterate over senses
    for(IWordID iWordId : iIndexWord.getWordIDs()) {
      IWord iWord1 = dict.getWord(iWordId);
      ISynset iSynset = iWord1.getSynset();
     
      for(ISynsetID iSynsetId1 : iSynset.getRelatedSynsets(Pointer.HYPERNYM)) {
        for(ISynsetID iSynsetId2 : dict.getSynset(iSynsetId1).getRelatedSynsets(Pointer.HYPERNYM)) {
View Full Code Here

    List<String> words = Lists.newArrayList(Splitter.on(CharMatcher.WHITESPACE).trimResults().omitEmptyStrings()
        .split(current));

    List<String> tagged = tagger.tag(words);
    IIndexWord idxWord;
    List<IWordID> wordID;
    IWord word;
    StringBuilder outDef = new StringBuilder();

    for (int i = 0; i < words.size(); i++) {
      // System.out.println(i);
      String definition = "";
      if (table.containsKey(tagged.get(i))) {
        if (nouns.containsKey(words.get(i))) {
          words.set(i, nouns.get(words.get(i)));
        }
        try {
          switch (table.get(tagged.get(i))) {
          case (1):
            idxWord = dict.getIndexWord(words.get(i), POS.NOUN);
            if (idxWord == null)
              break;
            wordID = idxWord.getWordIDs();
            word = dict.getWord(wordID.get(0));
            definition = word.getSynset().getGloss();
            break;
          case (2):
            tmpevent = port.createEventSet(words.get(i).toCharArray());
            idxWord = dict.getIndexWord(tmpevent.eventAt(0).toString(), POS.VERB);
            if (idxWord == null)
              break;
            wordID = idxWord.getWordIDs();
            word = dict.getWord(wordID.get(0));
            definition = word.getSynset().getGloss();
            break;
          case (3):
            idxWord = dict.getIndexWord(words.get(i), POS.ADJECTIVE);
            if (idxWord == null)
              break;
            wordID = idxWord.getWordIDs();
            word = dict.getWord(wordID.get(0));
            definition = word.getSynset().getGloss();
            break;
          case (4):
            idxWord = dict.getIndexWord(words.get(i), POS.ADVERB);
            if (idxWord == null)
              break;
            wordID = idxWord.getWordIDs();
            word = dict.getWord(wordID.get(0));
            definition = word.getSynset().getGloss();
            break;
          }
View Full Code Here

TOP

Related Classes of edu.mit.jwi.item.IIndexWord

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.