net.didion.jwnl.dictionary.Dictionary.lookupAllIndexWords()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中net.didion.jwnl.dictionary.Dictionary.lookupAllIndexWords()方法的一些代码示例,展示了Dictionary.lookupAllIndexWords()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dictionary.lookupAllIndexWords()方法的具体详情如下:
包路径:net.didion.jwnl.dictionary.Dictionary
类名称:Dictionary
方法名:lookupAllIndexWords

Dictionary.lookupAllIndexWords介绍

[英]Return a set of IndexWords, with each element in the set corresponding to a part-of-speech of word.
[中]返回一组IndexWords,其中每个元素对应于word的一个词性。

代码示例

代码示例来源:origin: Noahs-ARK/semafor

public void getAllIndexWords(String word){
  allIndexWords.clear();
  IndexWord[] iWordArr = null;
  IndexWord iWord = null;
  try {
    IndexWordSet iWordSet = wDict.lookupAllIndexWords(word);
    if(iWordSet != null){
      iWordArr = iWordSet.getIndexWordArray();
      for(int i=0;i<iWordArr.length;i++){
        iWord = iWordArr[i];
        //System.out.println("indexWord:"+iWord.getLemma());
        allIndexWords.add(iWord);
      }
    }  
  } catch (Exception e) {
    //System.out.println("getSynonym ERROR: " + word);
  }
}

代码示例来源:origin: CogComp/cogcomp-nlp

public synchronized POS[] getPOS(String s) throws JWNLException {
  // Look up all IndexWords (an IndexWord can only be one POS)
  IndexWordSet set = wordnet.lookupAllIndexWords(s);
  // Turn it into an array of IndexWords
  IndexWord[] words = set.getIndexWordArray();
  // Make the array of POS
  POS[] pos = new POS[words.length];
  for (int i = 0; i < words.length; i++) {
    pos[i] = words[i].getPOS();
  }
  return pos;
}

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-edison

public synchronized POS[] getPOS(String s) throws JWNLException {
  // Look up all IndexWords (an IndexWord can only be one POS)
  IndexWordSet set = wordnet.lookupAllIndexWords(s);
  // Turn it into an array of IndexWords
  IndexWord[] words = set.getIndexWordArray();
  // Make the array of POS
  POS[] pos = new POS[words.length];
  for (int i = 0; i < words.length; i++) {
    pos[i] = words[i].getPOS();
  }
  return pos;
}

代码示例来源:origin: hltfbk/Excitement-Open-Platform

public Map<WordNetPartOfSpeech, List<Synset>> getSortedSynsetOf(String lemma) throws WordNetException
{
  Map<WordNetPartOfSpeech, List<Synset>> ret = new HashMap<WordNetPartOfSpeech, List<Synset>>();
  if (doNotProcessThisWord(lemma)) ;
  else
  {
    try
    {
      net.didion.jwnl.data.IndexWordSet indexWordSet = jwnlRealDictionary.lookupAllIndexWords(lemma);
      if (indexWordSet!=null)
      {
        for (WordNetPartOfSpeech partOfSpeech : WordNetPartOfSpeech.values())
        {
          net.didion.jwnl.data.POS pos = JwnlUtils.getJwnlPartOfSpeec(partOfSpeech);
          if (indexWordSet.getIndexWord(pos)!=null)
            ret.put(partOfSpeech, indexWordToList(indexWordSet.getIndexWord(pos)));
        }
      }
    }
    catch(JWNLException e)
    {
      throw new WordNetException("looking for lemma <"+lemma+"> failed. See nested exception",e);
    }
  }
  return ret;
}

代码示例来源:origin: hltfbk/Excitement-Open-Platform

net.didion.jwnl.data.IndexWordSet indexWordSet = jwnlRealDictionary.lookupAllIndexWords(lemma);
if (indexWordSet!=null)

相关文章