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


Java PointerTargetNodeList.size方法代码示例

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


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

示例3: 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

示例4: 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

示例5: reverse

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

示例6: 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:duguyue100,项目名称:chomsky,代码行数:29,代码来源:PointerUtils.java


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