本文整理汇总了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");
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}