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

Java PointerTargetNode类代码示例

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

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



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

示例1: findWnMapMatch

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的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: getVerbGroup

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的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


示例3: getSetOfSynsets

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的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


示例4: getSynsets

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的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


示例5: reverse

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的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


示例6: findAsymmetricRelationship

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的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


示例7: findSymmetricRelationship

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的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


示例8: reverse

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的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


示例9: getCoordinateTerms

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的package包/类
/** Get <code>synset</code>'s siblings (the hyponyms of its hypernyms) */
public PointerTargetNodeList getCoordinateTerms(Synset synset) throws JWNLException {
	PointerTargetNodeList list = new PointerTargetNodeList();
	for (Iterator itr = getDirectHypernyms(synset).iterator(); itr.hasNext();) {
		list.addAll(getPointerTargets(((PointerTargetNode) itr.next()).getSynset(), PointerType.HYPONYM));
	}
	return list;
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:9,代码来源:PointerUtils.java


示例10: makePointerTargetTreeList

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的package包/类
/**
 * Make a nested list of pointer targets to depth <var>depth</var>, starting at each <code>synset</code> in
 * <var>list</var>. Each level of the list is related to the previous level by one of the pointer types specified
 * by <var>searchTypes</var>.
 * @param labelType the type used to label each pointer target in the tree
 * @param allowRedundancies if true, duplicate items will be included in the tree
 */
public PointerTargetTreeNodeList makePointerTargetTreeList(PointerTargetNodeList list, PointerType[] searchTypes,
                                                           PointerType labelType, int depth,
                                                           boolean allowRedundancies) throws JWNLException {
	PointerTargetTreeNodeList treeList = new PointerTargetTreeNodeList();
	for (Iterator itr = list.iterator(); itr.hasNext();) {
		PointerTargetNode node = (PointerTargetNode) itr.next();
		treeList.add(node.getPointerTarget(),
		             makePointerTargetTreeList(node.getSynset(), searchTypes, labelType, depth, allowRedundancies),
		             labelType);
	}
	return treeList;
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:20,代码来源:PointerUtils.java


示例11: findMatchForAdj

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的package包/类
public double findMatchForAdj(IndexWord index1, IndexWord index2) {
    // the max number of common concepts between the two tokens
    double value = 0;

    if (index1 != null && index2 != null) {
        // The two tokens existe in WordNet, we find the "depth"
        try {
            // Synsets for each token
            Synset[] Syno1 = index1.getSenses();
            Synset[] Syno2 = index2.getSenses();
            for (int i = 0; i < index1.getSenseCount(); i++) {

                Synset synset1 = Syno1[i];
                for (int k = 0; k < index2.getSenseCount(); k++) {

                    Synset synset2 = Syno2[k];

                    PointerTargetNodeList adjSynonymList = 
                        PointerUtils.getInstance().getSynonyms(synset1);

                    Iterator listIt = adjSynonymList.iterator();
                    // browse lists
                    while (listIt.hasNext()) {
                        PointerTargetNode ptn = (PointerTargetNode) listIt.next();
                        if (ptn.getSynset() == synset2) {
                            value = 1;
                        }
                    }
                }
            }
            // System.err.println("value = " + value);
            return value;
        }
        catch (JWNLException je) {
            je.printStackTrace();
            System.exit(-1);
        }
    }
    return 0;
}
 
开发者ID:dozed,项目名称:align-api-project,代码行数:41,代码来源:JWNLDistances.java


示例12: getCommonConcepts

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的package包/类
public int getCommonConcepts(PointerTargetNodeList list1,
    PointerTargetNodeList list2) {
    int cc = 0;
    int i = 1;
    while (i <= Math.min(list1.size(),
        list2.size()) && ((PointerTargetNode) list1.get(list1.size() - i))
            .getSynset() == ((PointerTargetNode) list2
            .get(list2.size() - i)).getSynset()) {
        cc++;
        i++;
    }
    return cc;

}
 
开发者ID:dozed,项目名称:align-api-project,代码行数:15,代码来源:JWNLDistances.java


示例13: getSourcePointerTarget

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的package包/类
/** Get the pointer target of the source node. */
public PointerTarget getSourcePointerTarget() {
	return ((PointerTargetNode) _nodes.get(0)).getPointerTarget();
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:5,代码来源:Relationship.java


示例14: getTargetPointerTarget

import net.didion.jwnl.data.list.PointerTargetNode; //导入依赖的package包/类
/** Get the pointer target of the target node. */
public PointerTarget getTargetPointerTarget() {
	return ((PointerTargetNode) _nodes.get(_nodes.size() - 1)).getPointerTarget();
}
 
开发者ID:duguyue100,项目名称:chomsky,代码行数:5,代码来源:Relationship.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java FileEncryptionInfo类代码示例发布时间:2022-05-22
下一篇:
Java TimeoutException类代码示例发布时间: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