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

Java PointerTargetNodeList类代码示例

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

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



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


示例16: getHypernymSynsets

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的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:TScottJ,项目名称:OpenEphyra,代码行数:10,代码来源:WordNet.java


示例17: makePointerTargetTreeList

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private PointerTargetTreeNodeList makePointerTargetTreeList(Synset synset, PointerType[] searchTypes,
                                                            PointerType labelType, int depth,
                                                            boolean allowRedundancies,
                                                            PointerTargetTreeNode parent) throws JWNLException {
    depth--;
	PointerTargetTreeNodeList list = new PointerTargetTreeNodeList();
	for (int i = 0; i < searchTypes.length; i++) {
		PointerType type = searchTypes[i];
		PointerTargetNodeList targets = new PointerTargetNodeList(synset.getTargets(type));
		if (targets.size() > 0) {
			for (Iterator itr = targets.iterator(); itr.hasNext();) {
                   PointerTargetNode ptr = (PointerTargetNode)itr.next();
                   ptr.getSynset();
                   PointerTargetTreeNode node =
				    new PointerTargetTreeNode(ptr.getPointerTarget(),
				                              labelType == null ? type : labelType, parent);
				if (allowRedundancies || !list.contains(node)) {
					if (depth != 0) {
						node.setChildTreeList(makePointerTargetTreeList(node.getSynset(), searchTypes, labelType,
						                                                depth, allowRedundancies, node));
					}
         				list.add(node);
				}
			}
		}
	}
	return list;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:29,代码来源:PointerUtils.java


示例18: reverse

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
public Relationship reverse() {
	PointerTargetNodeList list = ((PointerTargetNodeList)getNodeList().deepClone()).reverse();
	for (int i = 0; i < list.size(); i++) {
		((PointerTargetNode)list.get(i)).setType(getType().getSymmetricType());
	}
	return new SymmetricRelationship(getType(), list, getSourceSynset(), getTargetSynset());
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:8,代码来源:SymmetricRelationship.java


示例19: findAsymmetricRelationship

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
/**
 * Find a relationship between two asymmetric lists ordered from deepest
 * to shallowest ancestor. Each node has it's PointerType set to the kind of
 * relationship one need to follow to get from it to the next node in the list.
 * Take the dog/cat relationship. To get to carnivore, a hypernym relationship
 * must be used to get from dog to carnivore, but then a hyponym relationship
 * must be used to get from carnivore to cat. The list will look like this:
 * dog(hyper) -> canine(hyper) -> carnivore(hypo) -> feline(hypo) -> cat(hypo).
 * In this instance, cat's PointerType is meaningless, but is kept to facilitate
 * things like reversing the relationship (which just involves setting each node's
 * pointer type to the symmetric type of its current type.
 */
private Relationship findAsymmetricRelationship(
    PointerTargetNodeList sourceNodes, PointerTargetNodeList targetNodes,
    PointerType type, Synset sourceSynset, Synset targetSynset) {

	// If the deepest ancestors of the words are not the same,
	// then there is no relationship between the words.
	if (!sourceNodes.get(0).equals(targetNodes.get(0))) return null;

	PointerTargetNodeList relationship = new PointerTargetNodeList();
	int targetStart = 0;
	int commonParentIndex = 0;
	for (int i = sourceNodes.size() - 1; i >= 0; i--) {
		PointerTargetNode testNode = (PointerTargetNode)sourceNodes.get(i);
		int idx = targetNodes.indexOf(testNode);
		if (idx >= 0) {
			targetStart = idx;
			break;
		} else {
			relationship.add(testNode.clone());
			commonParentIndex++;
		}
	}
	for (int i = targetStart; i < targetNodes.size(); i++) {
		PointerTargetNode node = (PointerTargetNode)((PointerTargetNode)targetNodes.get(i)).clone();
		node.setType(type.getSymmetricType());
		relationship.add(node);
	}
	return new AsymmetricRelationship(type, relationship, commonParentIndex, sourceSynset, targetSynset);
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:42,代码来源:RelationshipFinder.java


示例20: findSymmetricRelationship

import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
/**
 * Build a relationsip from <var>node</var> back to it's root ancestor and
 * then reverse the list.
 */
private PointerTargetNodeList findSymmetricRelationship(PointerTargetTreeNode node, PointerType type) {
	PointerTargetNodeList list = new PointerTargetNodeList();
	buildSymmetricRelationshipList(list, node);
	list = list.reverse();
	// set the root's pointer type
	((PointerTargetNode)list.get(0)).setType(type);
	return list;
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:13,代码来源:RelationshipFinder.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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