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


Java PointerUtils类代码示例

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


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

示例1: getRelatedSynsets

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
public Set<Synset> getRelatedSynsets(WordNetRelation relation, int chainingLength) throws WordNetException {
	if (chainingLength < 1)
		throw new WordNetException("chaining length must be positive. I got " + chainingLength);
	if (WordNetRelation.STRICT_2ND_DEGREE_COUSIN.equals(relation))
		throw new WordNetMethodNotSupportedException("Extracting cousin relations is currently not supported by JwnlDictionary. Use JwiDictionary instead");
	PointerType pointerType = JwnlUtils.wordNetRelationToPointerType(relation);
	
	if (pointerType == null)		
		// some relations (inc. SYNONYM) have no neighbors, cos they have no matching JWNL relation
		// other relations just don't exist in ext JWNL
		return new HashSet<Synset>();
	else
	{
		if (!relation.isTransitive())
			chainingLength = 1;			// most relations make no sense when chained
		try {	return getSetOfSynsets(PointerUtils.getInstance().makePointerTargetTreeList(realSynset, pointerType, chainingLength));	}
		catch (JWNLException e) { throw new WordNetException("see nested" , e);	}
	}
}
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:20,代码来源:JwnlSynset.java

示例2: getCoordinateTerms

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
public Set<Synset> getCoordinateTerms() throws WordNetException
{
	try {
		return getSetOfSynsets(PointerUtils.getInstance().getCoordinateTerms(this.realSynset));
	} catch (JWNLException e) {
		throw new WordNetException("See nested", e);
	}
}
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:9,代码来源:JwnlSynset.java

示例3: getHolonyms

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
public Set<Synset> getHolonyms() throws WordNetException
{
	try {
		return getSetOfSynsets(PointerUtils.getInstance().getHolonyms(this.realSynset));
	} catch (JWNLException e) {
		throw new WordNetException("See nested", e);
	}
}
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:9,代码来源:JwnlSynset.java

示例4: getMeronyms

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
public Set<Synset> getMeronyms() throws WordNetException
{
	try {
		return getSetOfSynsets(PointerUtils.getInstance().getMeronyms(this.realSynset));
	} catch (JWNLException e) {
		throw new WordNetException("See nested", e);
	}
}
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:9,代码来源:JwnlSynset.java

示例5: initialize

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
/**
 * Initializes static resources.  The input properties that must be defined are:
 * <ul>
 *   <li>jwnl.configuration : </p>&nbsp; the location of the configuration file for JWNL
 *   <li>edu.cmu.lti.javelin.qa.english.WordNetAnswerTypeMapping.mapFile :
 *   <p>&nbsp; the location of the file specifying a mapping from WordNet synsets
 *   to answer subtypes.  The one-to-many mapping must be specified  
 *   one element per line, with the domain and range values separated by a comma. 
 *   Blank lines and lines beginning with "#" are ignored.  WordNet synsets must be
 *   represented by concatenating the list of lemmas in the synset, separating them 
 *   with a dash ("-"), followed by another "-" and the database file offset of the synset.
 *   (Note: this offset value will vary with the version of WordNet used.)</p>
 *   &nbsp; Thus, an example of an element of the mapping is:</p>
 *     <code>body_of_water-water-8651117,ocean</code>
 * </ul>
 * @throws Exception if one of the required properties is not defined.
 */
public static void initialize() throws Exception {
    if (isInitialized()) return;
    
    if (!JWNL.isInitialized()) {
        String file_properties = System.getProperty("jwnl.configuration");
        if (file_properties == null)
            throw new Exception("Required property 'jwnl.configuration' is undefined");
        JWNL.initialize(new FileInputStream(file_properties));
    }
    pUtils = PointerUtils.getInstance();
    
    Properties properties = Properties.loadFromClassName(WordNetAnswerTypeMapping.class.getName());
    
    String wnAtypeMapFile = properties.getProperty("mapFile");
    if (wnAtypeMapFile == null)
        throw new RuntimeException("Required parameter mapFile is undefined");

    BufferedReader in = new BufferedReader(new FileReader(wnAtypeMapFile));
    String line;
    wnAtypeMap = new HashMap<String, String>();
    wnAtypeMapKeys = new ArrayList<String>();
    while ((line = in.readLine()) != null) {
        if (line.matches("#.*") || line.matches("\\s*")) continue;
        String[] strs = line.split(",");
        wnAtypeMap.put(strs[0],strs[1]);
        wnAtypeMapKeys.add(strs[0]);
    }
    in.close();
    setInitialized(true);
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:48,代码来源:WordNetAnswerTypeMapping.java

示例6: getHypernymSynsets

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
private static Synset[] getHypernymSynsets(Synset synset) {
	PointerTargetNodeList hypernyms = null;
	try {
		hypernyms = PointerUtils.getInstance().getDirectHypernyms(synset);
	} catch (JWNLException e) {}
	if (hypernyms == null) return null;
	
	return getSynsets(hypernyms);
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:10,代码来源:WordNet.java

示例7: getHyponymSynsets

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
private static Synset[] getHyponymSynsets(Synset synset) {
	PointerTargetNodeList hyponyms = null;
	try {
		hyponyms = PointerUtils.getInstance().getDirectHyponyms(synset);
	} catch (JWNLException e) {}
	if (hyponyms == null) return null;
	
	return getSynsets(hyponyms);
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:10,代码来源:WordNet.java

示例8: getEntailingSynsets

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
private static Synset[] getEntailingSynsets(Synset synset) {
	PointerTargetNodeList entailing = null;
	try {
		entailing = PointerUtils.getInstance().getEntailments(synset);
	} catch (JWNLException e) {}
	if (entailing == null) return null;
	
	return getSynsets(entailing);
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:10,代码来源:WordNet.java

示例9: getCausingSynsets

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
private static Synset[] getCausingSynsets(Synset synset) {
	PointerTargetNodeList causing = null;
	try {
		causing = PointerUtils.getInstance().getCauses(synset);
	} catch (JWNLException e) {}
	if (causing == null) return null;
	
	return getSynsets(causing);
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:10,代码来源:WordNet.java

示例10: getMemberOfSynsets

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
private static Synset[] getMemberOfSynsets(Synset synset) {
	PointerTargetNodeList membersOf = null;
	try {
		membersOf = PointerUtils.getInstance().getMemberHolonyms(synset);
	} catch (JWNLException e) {}
	if (membersOf == null) return null;
	
	return getSynsets(membersOf);
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:10,代码来源:WordNet.java

示例11: getSubstanceOfSynsets

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
private static Synset[] getSubstanceOfSynsets(Synset synset) {
	PointerTargetNodeList substancesOf = null;
	try {
		substancesOf = PointerUtils.getInstance().getSubstanceHolonyms(synset);
	} catch (JWNLException e) {}
	if (substancesOf == null) return null;
	
	return getSynsets(substancesOf);
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:10,代码来源:WordNet.java

示例12: getPartOfSynsets

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
private static Synset[] getPartOfSynsets(Synset synset) {
	PointerTargetNodeList partsOf = null;
	try {
		partsOf = PointerUtils.getInstance().getPartHolonyms(synset);
	} catch (JWNLException e) {}
	if (partsOf == null) return null;
	
	return getSynsets(partsOf);
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:10,代码来源:WordNet.java

示例13: getHasMemberSynsets

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
private static Synset[] getHasMemberSynsets(Synset synset) {
	PointerTargetNodeList haveMember = null;
	try {
		haveMember = PointerUtils.getInstance().getMemberMeronyms(synset);
	} catch (JWNLException e) {}
	if (haveMember == null) return null;
	
	return getSynsets(haveMember);
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:10,代码来源:WordNet.java

示例14: getHasSubstanceSynsets

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
private static Synset[] getHasSubstanceSynsets(Synset synset) {
	PointerTargetNodeList haveSubstance = null;
	try {
		haveSubstance = PointerUtils.getInstance().getSubstanceMeronyms(synset);
	} catch (JWNLException e) {}
	if (haveSubstance == null) return null;
	
	return getSynsets(haveSubstance);
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:10,代码来源:WordNet.java

示例15: getHasPartSynsets

import net.didion.jwnl.data.PointerUtils; //导入依赖的package包/类
private static Synset[] getHasPartSynsets(Synset synset) {
	PointerTargetNodeList havePart = null;
	try {
		havePart = PointerUtils.getInstance().getPartMeronyms(synset);
	} catch (JWNLException e) {}
	if (havePart == null) return null;
	
	return getSynsets(havePart);
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:10,代码来源:WordNet.java


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