当前位置: 首页>>代码示例>>Java>>正文


Java POS.values方法代码示例

本文整理汇总了Java中edu.mit.jwi.item.POS.values方法的典型用法代码示例。如果您正苦于以下问题:Java POS.values方法的具体用法?Java POS.values怎么用?Java POS.values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.mit.jwi.item.POS的用法示例。


在下文中一共展示了POS.values方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: trek

import edu.mit.jwi.item.POS; //导入方法依赖的package包/类
/**
 * Treking across Wordnet for performance measurements
 * 
 */
private void trek() {
  int tickNext = 0;
  int tickSize = 20000;
  int seen = 0;
  System.out.print("Treking across Wordnet");
  long t = System.currentTimeMillis();
  for (POS pos : POS.values()) {
    for (Iterator<IIndexWord> i = m_dict.getIndexWordIterator(pos); i
        .hasNext();) {
      for (IWordID wid : i.next().getWordIDs()) {
        seen += m_dict.getWord(wid).getSynset().getWords().size();
        if (seen > tickNext) {
          System.out.print(".");
          tickNext = seen + tickSize;
        }
      }
    }
  }
  System.out.printf("done (%1d msec)\n", System.currentTimeMillis() - t);
  System.out.println("In my trek I saw " + seen + " words");
}
 
开发者ID:millecker,项目名称:storm-apps,代码行数:26,代码来源:WordNet.java

示例2: contains

import edu.mit.jwi.item.POS; //导入方法依赖的package包/类
public boolean contains(String word) {
  for (POS pos : POS.values()) {
    for (String stem : m_wordnetStemmer.findStems(word, pos)) {
      IIndexWord indexWord = m_dict.getIndexWord(stem, pos);
      if (indexWord != null)
        return true;
    }
  }
  return false;
}
 
开发者ID:millecker,项目名称:senti-storm,代码行数:11,代码来源:WordNet.java

示例3: findPOS

import edu.mit.jwi.item.POS; //导入方法依赖的package包/类
public synchronized POS findPOS(String word) {
  int maxCount = 0;
  POS mostLikelyPOS = null;
  for (POS pos : POS.values()) {
    // From JavaDoc: The surface form may or may not contain whitespace or
    // underscores, and may be in mixed case.
    word = word.replaceAll("\\s", "").replaceAll("_", "");

    List<String> stems = m_wordnetStemmer.findStems(word, pos);
    for (String stem : stems) {
      IIndexWord indexWord = m_dict.getIndexWord(stem, pos);
      if (indexWord != null) {
        int count = 0;
        for (IWordID wordId : indexWord.getWordIDs()) {
          IWord aWord = m_dict.getWord(wordId);
          ISenseEntry senseEntry = m_dict.getSenseEntry(aWord.getSenseKey());
          count += senseEntry.getTagCount();
        }

        if (count > maxCount) {
          maxCount = count;
          mostLikelyPOS = pos;
        }
      }
    }
  }

  return mostLikelyPOS;
}
 
开发者ID:millecker,项目名称:senti-storm,代码行数:30,代码来源:WordNet.java

示例4: getSenseFromSenseKey

import edu.mit.jwi.item.POS; //导入方法依赖的package包/类
public IWord getSenseFromSenseKey(final String sensekey)
{
	final String lemma = sensekey.split("%")[0];
	final Set<IWord> senses = new HashSet<IWord>();
	for (POS pos : POS.values())
		senses.addAll(getSenses(lemma, pos));

	for (IWord sense : senses)
		if (sense.getSenseKey().toString().equals(sensekey))
			return sense;

	return null;
}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:14,代码来源:WordNetUtils.java

示例5: getWordNetStems

import edu.mit.jwi.item.POS; //导入方法依赖的package包/类
public Set<String> getWordNetStems(String word)
{
 Set<String> stems = new HashSet<String>();

 for (POS pos : POS.values())
	 stems.addAll(wnStemmer.findStems(word, pos));

 return stems;
}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:10,代码来源:WordNetUtils.java

示例6: getAllIndexWords

import edu.mit.jwi.item.POS; //导入方法依赖的package包/类
public Set<IIndexWord> getAllIndexWords(String word) {
  Set<IIndexWord> indexWords = new HashSet<IIndexWord>();
  for (POS pos : POS.values()) {
    IIndexWord indexWord = m_dict.getIndexWord(word, pos);
    if (indexWord != null) {
      indexWords.add(indexWord);
    }
  }
  return indexWords;
}
 
开发者ID:millecker,项目名称:storm-apps,代码行数:11,代码来源:WordNet.java


注:本文中的edu.mit.jwi.item.POS.values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。