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


Java PointerTargetNodeList类代码示例

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


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

示例1: findWnMapMatch

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static AnswerType findWnMapMatch(Synset synset,int level) throws Exception {
    AnswerType type = null;
    String synsetId = buildSynsetString(synset);
    String typeStr = wnAtypeMap.get(synsetId);
    if (typeStr != null) {
        type = AnswerType.constructFromString(typeStr);
        type.setConfidence( 1.0 - ((double)level / 100.0));
        return type;
    }
    PointerTargetNodeList ptNodeList = null;
    ptNodeList = pUtils.getDirectHypernyms(synset);
    for (int i = 0; i < ptNodeList.size(); i++) {
        Synset parent = (Synset)((PointerTargetNode)ptNodeList.get(i)).getPointerTarget();
        type = findWnMapMatch(parent,level+1);
        if (type != null) return type;
    }
    return type;
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:19,代码来源:WordNetAnswerTypeMapping.java

示例2: findAsymmetricRelationships

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
/**
 * Finds the asymmetric relationship(s) between two words. A relationship is
 * asymmetric if its type is asymmetric (i.e. it's not its own inverse).
 */
private RelationshipList findAsymmetricRelationships(
    Synset sourceSynset, Synset targetSynset, PointerType type, int depth) throws JWNLException {

	// We run the reversal function on the trees to get linear (non-branching)
	// paths from the source word to its deepest ancestor (i.e. if there are
	// multiple relations from a single word anywhere in the path, the reversal
	// function will break them down into multiple, linear paths).
	PointerTargetNodeList[] sourceRelations = new PointerTargetTree(
	    sourceSynset, PointerUtils.getInstance().makePointerTargetTreeList(sourceSynset, type, depth)).reverse();
	PointerTargetNodeList[] targetRelations = new PointerTargetTree(
	    targetSynset, PointerUtils.getInstance().makePointerTargetTreeList(targetSynset, type, depth)).reverse();

	RelationshipList relationships = new RelationshipList();
	// Do an exhaustive search for relationships
	for (int i = 0; i < sourceRelations.length; i++) {
		for (int j = 0; j < targetRelations.length; j++) {
			Relationship relationship = findAsymmetricRelationship(
			    sourceRelations[i], targetRelations[j], type, sourceSynset, targetSynset);
			if (relationship != null) {
				relationships.add(relationship);
			}
		}
	}
	return relationships;
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:30,代码来源:RelationshipFinder.java

示例3: findSymmetricRelationships

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
/** A symmetric relationship is one whose type is symmetric (i.e. is it's own inverse). */
private RelationshipList findSymmetricRelationships(
    final Synset sourceSynset, final Synset targetSynset, PointerType type, int depth) throws JWNLException {

	PointerTargetTree tree = new PointerTargetTree(
	    sourceSynset, PointerUtils.getInstance().makePointerTargetTreeList(sourceSynset, type, null, depth, false));

	PointerTargetTreeNodeList.Operation opr = new PointerTargetTreeNodeList.Operation() {
		public Object execute(PointerTargetTreeNode testNode) {
                if (targetSynset.equals(testNode.getSynset())) {
                   
				return testNode;
			}
			return null;
		}
	};
	List l = tree.getAllMatches(opr);

	RelationshipList list = new RelationshipList();
	for (int i = 0; i < l.size(); i++) {
		PointerTargetNodeList nodes = findSymmetricRelationship((PointerTargetTreeNode)l.get(i), type);
		list.add(new SymmetricRelationship(type, nodes, sourceSynset, targetSynset));
	}
	return list;
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:26,代码来源:RelationshipFinder.java

示例4: getVerbGroup

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
/** Get the group that this verb belongs to. */
public PointerTargetNodeList getVerbGroup(Synset synset) throws JWNLException {
	// We need to go through all this hastle because
	// 1. a verb does not always have links to all the verbs in its group
	// 2. two verbs in the same group sometimes have reciprocal links, and we want
	//    to make sure that each verb synset appears in the final list only once

	PointerTargetNodeList nodes = new PointerTargetNodeList();
	nodes.add(new PointerTargetNode(synset, PointerType.VERB_GROUP));
	int maxIndex = 0;
	int index = -1;
	do {
		index++;
		PointerTargetNode node = (PointerTargetNode) nodes.get(index);
		for (Iterator itr = getPointerTargets(node.getSynset(), PointerType.VERB_GROUP).iterator(); itr.hasNext();) {
			PointerTargetNode testNode = (PointerTargetNode) itr.next();
			if (!nodes.contains(testNode)) {
				nodes.add(testNode);
				maxIndex++;
			}
		}
	} while (index < maxIndex);

	return nodes;
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:26,代码来源:PointerUtils.java

示例5: getSetOfSynsets

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
protected Set<Synset> getSetOfSynsets(PointerTargetNodeList list)
{
	if (null==list)
		return null;
	Set<Synset> ret = new HashSet<Synset>();
	for (Object nodeAsObject : list)
	{
		PointerTargetNode node = (PointerTargetNode) nodeAsObject;
		ret.add(new JwnlSynset(this.jwnlDictionary,node.getSynset()));
		
	}
	return ret;
}
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:14,代码来源:JwnlSynset.java

示例6: getSynsets

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
/**
 * Looks up the synsets that correspond to the nodes in a node list.
 * 
 * @param nodes node list
 * @return synsets
 */
private static Synset[] getSynsets(PointerTargetNodeList nodes) {
	Synset[] synsets = new Synset[nodes.size()];
	
	for (int i = 0; i < nodes.size(); i++) {
		PointerTargetNode node  = (PointerTargetNode) nodes.get(i);
		synsets[i] = node.getSynset();
	}
	
	return synsets;
}
 
开发者ID:claritylab,项目名称:lucida,代码行数:17,代码来源:WordNet.java

示例7: getHyponymSynsets

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的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.list.PointerTargetNodeList; //导入依赖的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.list.PointerTargetNodeList; //导入依赖的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.list.PointerTargetNodeList; //导入依赖的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.list.PointerTargetNodeList; //导入依赖的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.list.PointerTargetNodeList; //导入依赖的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.list.PointerTargetNodeList; //导入依赖的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.list.PointerTargetNodeList; //导入依赖的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.list.PointerTargetNodeList; //导入依赖的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.list.PointerTargetNodeList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。