• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IndexWordSet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.didion.jwnl.data.IndexWordSet的典型用法代码示例。如果您正苦于以下问题:Java IndexWordSet类的具体用法?Java IndexWordSet怎么用?Java IndexWordSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IndexWordSet类属于net.didion.jwnl.data包,在下文中一共展示了IndexWordSet类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: isCompoundWord

import net.didion.jwnl.data.IndexWordSet; //导入依赖的package包/类
/**
 * Checks if the word exists in WordNet. Supports multi-token terms.
 * 
 * @param word a word
 * @return <code>true</code> iff the word is in WordNet
 */
public static boolean isCompoundWord(String word) {
	if (dict == null) return false;
	
	// do not look up words with special characters other than '.'
	if (word.matches(".*?[^\\w\\s\\.].*+")) return false;
	
	IndexWordSet indexWordSet = null;
	try {
		indexWordSet = dict.lookupAllIndexWords(word);
	} catch (JWNLException e) {}
	
	// ensure that the word, and not just a substring, was found in WordNet
	int wordTokens = word.split("\\s", -1).length;
	int wordDots = word.split("\\.", -1).length;
	for (IndexWord indexWord : indexWordSet.getIndexWordArray()) {
		String lemma = indexWord.getLemma();
		int lemmaTokens = lemma.split("\\s", -1).length;
		int lemmaDots = lemma.split("\\.", -1).length;
		if (wordTokens == lemmaTokens && wordDots == lemmaDots) return true;
	}
	return false;
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:29,代码来源:WordNet.java


示例2: _loadWordSenses

import net.didion.jwnl.data.IndexWordSet; //导入依赖的package包/类
private void _loadWordSenses() throws WordNetException {

//    Dictionary dict = this.wnMain.getJWNLDictionary();

    try {
      IndexWordSet iwSet = this.wnDictionary.lookupAllIndexWords(this.lemma);
      IndexWord[] arrIndexWords = iwSet.getIndexWordArray();

      for (int i=0; i< arrIndexWords.length; i++) {
        IndexWord iWord = arrIndexWords[i];
        net.didion.jwnl.data.Synset[] synsets = iWord.getSenses();
        for (int j=0; j< synsets.length; j++) {
          net.didion.jwnl.data.Synset currSynset = synsets[j];
        }
      }

//      this.
    }
    catch(JWNLException jwne) {
      throw new WordNetException(jwne);
    }

  }
 
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:24,代码来源:WordImpl.java


示例3: isWord

import net.didion.jwnl.data.IndexWordSet; //导入依赖的package包/类
/**
 * Checks if the word exists in WordNet.
 * 
 * @param word a word
 * @return <code>true</code> iff the word is in WordNet
 */
public static boolean isWord(String word) {
	if (dict == null) return false;
	
	IndexWordSet indexWordSet = null;
	try {
		indexWordSet = dict.lookupAllIndexWords(word);
	} catch (JWNLException e) {}
	
	return indexWordSet.size() > 0;
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:17,代码来源:WordNet.java


示例4: lookupAllIndexWords

import net.didion.jwnl.data.IndexWordSet; //导入依赖的package包/类
/**
 * Return a set of <code>IndexWord</code>s, with each element in the set
 * corresponding to a part-of-speech of <var>word</var>.
 * @param lemma the word for which to lookup senses
 * @return An array of IndexWords, each of which is a sense of <var>word</var>
 */
public IndexWordSet lookupAllIndexWords(String lemma) throws JWNLException {
	lemma = prepareQueryString(lemma);
	IndexWordSet set = new IndexWordSet(lemma);
	for (Iterator itr = POS.getAllPOS().iterator(); itr.hasNext();) {
		IndexWord current = lookupIndexWord((POS)itr.next(), lemma);
		if (current != null) set.add(current);
	}
	return set;
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:16,代码来源:Dictionary.java


示例5: getAllSenses

import net.didion.jwnl.data.IndexWordSet; //导入依赖的package包/类
/**
    * Retrieve all WordNet senses of a term
    * @param term
    * @return the set of senses of term
    */

   @SuppressWarnings("unchecked") // WordNet non-1.5
   Set<Synset> getAllSenses( String term ) throws OntoSimException {
Set<Synset> res = new HashSet<Synset>();
IndexWordSet iws = null;
try {
    iws = dictionary.lookupAllIndexWords( term );
} catch ( JWNLException ex ) {
    throw new OntoSimException( "Wordnet exception", ex );
       }
if ( iws != null ) {
    // not iterable...
    for ( IndexWord idx : (Collection<IndexWord>)iws.getIndexWordCollection() ) {
	Synset Syno[] = null;
	try {
	    // get the synsets for each sense
	    Syno = idx.getSenses();
	} catch ( JWNLException jwnlex ) {
	    throw new OntoSimException( "Wordnet exception", jwnlex );
	    //jwnlex.printStackTrace();
	}
	// number of senses for the word s1
	int synonymNb = idx.getSenseCount();
	// for each sense
	for ( int k = 0; k < synonymNb; k++ ) {
	    res.add( Syno[k] );
	}
    }
}
return res;
   }
 
开发者ID:dozed,项目名称:align-api-project,代码行数:37,代码来源:JWNLDistances.java



注:本文中的net.didion.jwnl.data.IndexWordSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Column类代码示例发布时间:2022-05-22
下一篇:
Java ProcessDocReport类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap