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

Java PointerTargetNodeList类代码示例

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

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



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

示例1: traverseTree

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static void traverseTree(Set<Long> keys, PointerTargetTree syn, long sourceOffset) {
    for (Object aMGListsList : syn.toList()) {
        for (Object ptn : (PointerTargetNodeList) aMGListsList) {
            long targetOffset = ((PointerTargetNode) ptn).getSynset().getOffset();
            if (sourceOffset != targetOffset) {
                long key;
                if (targetOffset > sourceOffset) {
                    key = (targetOffset << 32) + sourceOffset;
                } else {
                    key = (sourceOffset << 32) + targetOffset;
                }
                keys.add(key);
            }
        }
    }
}
 
开发者ID:s-match,项目名称:s-match-wordnet,代码行数:17,代码来源:InMemoryWordNetBinaryArray.java


示例2: getParents

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
public List<ISense> getParents(int depth) throws LinguisticOracleException {
    List<ISense> out = new ArrayList<>();
    try {
        PointerTargetTree hypernyms = PointerUtils.getHypernymTree(synset, depth);
        for (Iterator itr = hypernyms.toList().iterator(); itr.hasNext(); ) {
            if (itr.hasNext()) {
                for (Object o : ((PointerTargetNodeList) itr.next())) {
                    Synset t = ((PointerTargetNode) o).getSynset();
                    if (!synset.equals(t)) {
                        out.add(new WordNetSense(t));
                    }
                }
            }
        }
    } catch (JWNLException e) {
        throw new LinguisticOracleException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
    }
    return out;
}
 
开发者ID:s-match,项目名称:s-match-wordnet,代码行数:20,代码来源:WordNetSense.java


示例3: getChildren

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
public List<ISense> getChildren(int depth) throws LinguisticOracleException {
    List<ISense> out = new ArrayList<>();
    try {
        PointerTargetTree hypernyms = PointerUtils.getHyponymTree(synset, depth);
        for (Iterator itr = hypernyms.toList().iterator(); itr.hasNext(); ) {
            if (itr.hasNext()) {
                for (Object o : ((PointerTargetNodeList) itr.next())) {
                    Synset t = ((PointerTargetNode) o).getSynset();
                    if (!synset.equals(t)) {
                        out.add(new WordNetSense(t));
                    }
                }
            }
        }
    } catch (JWNLException e) {
        throw new LinguisticOracleException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
    }
    return out;
}
 
开发者ID:s-match,项目名称:s-match-wordnet,代码行数:20,代码来源:WordNetSense.java


示例4: Relationship

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
protected Relationship(PointerType type, PointerTargetNodeList nodes, Synset sourceSynset, Synset targetSynset) {
    if (null == type) {
        throw new IllegalArgumentException("Type must be not null");
    }
    this.type = type;
    if (null == nodes) {
        throw new IllegalArgumentException("Nodes must be not null");
    }
    this.nodes = nodes;
    if (null == sourceSynset) {
        throw new IllegalArgumentException("Source synset must be not null");
    }
    this.sourceSynset = sourceSynset;
    if (null == targetSynset) {
        throw new IllegalArgumentException("Target synset must be not null");
    }
    this.targetSynset = targetSynset;
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:19,代码来源:Relationship.java


示例5: testReverse

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
@Test
public void testReverse() throws JWNLException, CloneNotSupportedException {
    dictionary.edit();
    Synset s1 = dictionary.createSynset(POS.NOUN);
    Synset s2 = dictionary.createSynset(POS.NOUN);
    SymmetricRelationship r =
            new SymmetricRelationship(PointerType.HYPERNYM,
                    new PointerTargetNodeList(Arrays.asList(
                            new PointerTargetNode(s1),
                            new PointerTargetNode(s2)
                    )),
                    s1, s2);
    Relationship rev = r.reverse();

    Assert.assertEquals(2, rev.getSize());
    Assert.assertEquals(2, rev.getNodeList().size());
    Assert.assertEquals(PointerType.HYPONYM, rev.getNodeList().get(0).getType());
    Assert.assertEquals(PointerType.HYPONYM, rev.getNodeList().get(1).getType());
    Assert.assertEquals(s2, rev.getNodeList().get(0).getSynset());
    Assert.assertEquals(s1, rev.getNodeList().get(1).getSynset());
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:22,代码来源:TestSymmetricRelationship.java


示例6: testGetShallowest

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
@Test
public void testGetShallowest() throws JWNLException {
    RelationshipList l = new RelationshipList();
    Assert.assertNull(l.getShallowest());
    Assert.assertNull(l.getDeepest());

    Relationship r = new SymmetricRelationship(PointerType.ANTONYM,
            new PointerTargetNodeList(Arrays.asList(new PointerTargetNode(new Synset(null, POS.NOUN)))),
            new Synset(null, POS.NOUN), new Synset(null, POS.NOUN));

    l.add(r);
    Assert.assertEquals(r, l.getDeepest());
    Assert.assertEquals(r, l.getShallowest());

    Relationship rr = new SymmetricRelationship(PointerType.ANTONYM,
            new PointerTargetNodeList(),
            new Synset(null, POS.NOUN), new Synset(null, POS.NOUN));

    l.add(rr);
    Assert.assertEquals(r, l.getDeepest());
    Assert.assertEquals(rr, l.getShallowest());
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:23,代码来源:TestRelationshipList.java


示例7: testGetDeepest

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
@Test
public void testGetDeepest() throws JWNLException {
    RelationshipList l = new RelationshipList();
    Assert.assertNull(l.getShallowest());
    Assert.assertNull(l.getDeepest());


    Relationship r = new SymmetricRelationship(PointerType.ANTONYM,
            new PointerTargetNodeList(),
            new Synset(null, POS.NOUN), new Synset(null, POS.NOUN));

    l.add(r);
    Assert.assertEquals(r, l.getDeepest());
    Assert.assertEquals(r, l.getShallowest());

    Relationship rr = new SymmetricRelationship(PointerType.ANTONYM,
            new PointerTargetNodeList(Arrays.asList(new PointerTargetNode(new Synset(null, POS.NOUN)))),
            new Synset(null, POS.NOUN), new Synset(null, POS.NOUN));

    l.add(rr);
    Assert.assertEquals(rr, l.getDeepest());
    Assert.assertEquals(r, l.getShallowest());
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:24,代码来源:TestRelationshipList.java


示例8: testGetRelativeTargetDepth

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
@Test
public void testGetRelativeTargetDepth() throws JWNLException {
    dictionary.edit();
    Synset s1 = dictionary.createSynset(POS.NOUN);
    Synset s2 = dictionary.createSynset(POS.NOUN);
    Synset s3 = dictionary.createSynset(POS.NOUN);
    AsymmetricRelationship r =
            new AsymmetricRelationship(PointerType.HYPERNYM, new PointerTargetNodeList(
                    Arrays.asList(
                            new PointerTargetNode(s1),
                            new PointerTargetNode(s2),
                            new PointerTargetNode(s3)
                    )
            ), 1, s1, s3);

    Assert.assertEquals(0, r.getRelativeTargetDepth());
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:18,代码来源:TestAsymmetricRelationship.java


示例9: testReverse

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
@Test
public void testReverse() throws JWNLException, CloneNotSupportedException {
    dictionary.edit();
    Synset s1 = dictionary.createSynset(POS.NOUN);
    Synset s2 = dictionary.createSynset(POS.NOUN);
    Synset s3 = dictionary.createSynset(POS.NOUN);
    AsymmetricRelationship r =
            new AsymmetricRelationship(PointerType.HYPERNYM,
                    new PointerTargetNodeList(Arrays.asList(
                            new PointerTargetNode(s1, PointerType.HYPERNYM),
                            new PointerTargetNode(s2, PointerType.HYPERNYM),
                            new PointerTargetNode(s3, PointerType.HYPONYM)
                    )),
                    1,
                    s1, s2);
    Relationship rev = r.reverse();

    Assert.assertEquals(3, rev.getSize());
    Assert.assertEquals(3, rev.getNodeList().size());
    Assert.assertEquals(PointerType.HYPONYM, rev.getNodeList().get(0).getType());
    Assert.assertEquals(PointerType.HYPERNYM, rev.getNodeList().get(1).getType());
    Assert.assertEquals(PointerType.HYPONYM, rev.getNodeList().get(2).getType());
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:24,代码来源:TestAsymmetricRelationship.java


示例10: traverseTree

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static void traverseTree(HashSet<Long> keys, PointerTargetTree syn, long sourceOffset) {
    for (Object aMGListsList : syn.toList()) {
        for (Object ptn : (PointerTargetNodeList) aMGListsList) {
            long targetOffset = ((PointerTargetNode) ptn).getSynset().getOffset();
            if (sourceOffset != targetOffset) {
                long key;//null;
                if (targetOffset > sourceOffset) {
                    key = (targetOffset << 32) + sourceOffset;
                } else {
                    key = (sourceOffset << 32) + targetOffset;
                }
                keys.add(key);
            }
        }
    }
}
 
开发者ID:opendatatrentino,项目名称:s-match,代码行数:17,代码来源:InMemoryWordNetBinaryArray.java


示例11: getSetOfSynsets

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


示例12: isSourceMoreGeneralThanTarget

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
public boolean isSourceMoreGeneralThanTarget(ISense source, ISense target) throws SenseMatcherException {
    if ((source instanceof WordNetSense) && (target instanceof WordNetSense)) {
        WordNetSense sourceSyn = (WordNetSense) source;
        WordNetSense targetSyn = (WordNetSense) target;

        if ((POS.NOUN == sourceSyn.getPOS() && POS.NOUN == targetSyn.getPOS()) || (POS.VERB == sourceSyn.getPOS() && POS.VERB == targetSyn.getPOS())) {
            if (source.equals(target)) {
                return false;
            }
            try {
                // find all more general relationships from WordNet
                RelationshipList list = RelationshipFinder.findRelationships(sourceSyn.getSynset(), targetSyn.getSynset(), PointerType.HYPERNYM);
                if (!isUnidirectional(list)) {
                    PointerTargetTree ptt = PointerUtils.getInheritedMemberHolonyms(targetSyn.getSynset());
                    PointerTargetNodeList ptnl = PointerUtils.getMemberHolonyms(targetSyn.getSynset());
                    if (!traverseTree(ptt, ptnl, sourceSyn.getSynset())) {
                        ptt = PointerUtils.getInheritedPartHolonyms(targetSyn.getSynset());
                        ptnl = PointerUtils.getPartHolonyms(targetSyn.getSynset());
                        if (!traverseTree(ptt, ptnl, sourceSyn.getSynset())) {
                            ptt = PointerUtils.getInheritedSubstanceHolonyms(targetSyn.getSynset());
                            ptnl = PointerUtils.getSubstanceHolonyms(targetSyn.getSynset());
                            if (traverseTree(ptt, ptnl, sourceSyn.getSynset())) {
                                return true;
                            }
                        } else {
                            return true;
                        }
                    } else {
                        return true;
                    }
                } else {
                    return true;
                }
            } catch (CloneNotSupportedException | JWNLException e) {
                throw new SenseMatcherException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
            }
        }
    }
    return false;
}
 
开发者ID:s-match,项目名称:s-match-wordnet,代码行数:41,代码来源:WordNet.java


示例13: traverseListMG

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static void traverseListMG(Set<Long> keys, PointerTargetNodeList pointers, long sourceOffset) {
    for (Object pointer : pointers) {
        long targetOffset = ((PointerTargetNode) pointer).getSynset().getOffset();
        if (sourceOffset != targetOffset) {
            long key = (sourceOffset << 32) + targetOffset;
            keys.add(key);
        }
    }
}
 
开发者ID:s-match,项目名称:s-match-wordnet,代码行数:10,代码来源:InMemoryWordNetBinaryArray.java


示例14: traverseListSym

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static void traverseListSym(Set<Long> keys, PointerTargetNodeList pointers, long sourceOffset) {
    for (Object ptn : pointers) {
        long targetOffset = ((PointerTargetNode) ptn).getSynset().getOffset();
        if (sourceOffset != targetOffset) {
            long key;//null;
            if (targetOffset > sourceOffset) {
                key = (targetOffset << 32) + sourceOffset;
            } else {
                key = (sourceOffset << 32) + targetOffset;
            }
            keys.add(key);
        }
    }
}
 
开发者ID:s-match,项目名称:s-match-wordnet,代码行数:15,代码来源:InMemoryWordNetBinaryArray.java


示例15: traverseTreeMG

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static void traverseTreeMG(Set<Long> keys, PointerTargetTree syn, long sourceOffset) {
    for (Object aMGListsList : syn.toList()) {
        for (Object ptn : (PointerTargetNodeList) aMGListsList) {
            long targetOffset = ((PointerTargetNode) ptn).getSynset().getOffset();
            if (sourceOffset != targetOffset) {
                long key = (sourceOffset << 32) + targetOffset;
                keys.add(key);
            }
        }
    }
}
 
开发者ID:s-match,项目名称:s-match-wordnet,代码行数:12,代码来源:InMemoryWordNetBinaryArray.java


示例16: findAsymmetricRelationship

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
/**
 * This is directly copied from extJWNL's RelationshipFinder class. It
 * iterates over the list of source nodes and checks to see if any of the
 * target nodes share a common index. If a node is found, its added to the
 * pointer target node list and returned as a Relationship.
 * 
 * @param sourceNodes
 * @param targetNodes
 * @param type
 * @param sourceSynset
 * @param targetSynset
 * @return
 * @throws CloneNotSupportedException
 */
private static Relationship findAsymmetricRelationship(
		PointerTargetNodeList sourceNodes,
		PointerTargetNodeList targetNodes, PointerType type,
		Synset sourceSynset, Synset targetSynset)
		throws CloneNotSupportedException {
	PointerTargetNode sourceRoot = (PointerTargetNode) sourceNodes.get(0);
	PointerTargetNode targetRoot = (PointerTargetNode) targetNodes.get(0);

	// If the deepest ancestor of both trees is not common,
	// there is no relationship between them
	if (!sourceRoot.getSynset().equals(targetRoot.getSynset())) {
		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;
		}
		relationship.add(testNode.clone());
		commonParentIndex++;
	}

	for (int i = targetStart; i < targetNodes.size(); i++) {
		PointerTargetNode node = ((PointerTargetNode) targetNodes.get(i))
				.clone();
		node.setType(type.getSymmetricType());
		relationship.add(node);
	}

	return new AsymmetricRelationship(type, relationship,
			commonParentIndex, sourceSynset, targetSynset);
}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:54,代码来源:RelationshipFinder.java


示例17: reverse

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
public Relationship reverse() throws CloneNotSupportedException {
    PointerTargetNodeList list = getNodeList().deepClone().reverse();
    for (Object aList : list) {
        ((PointerTargetNode) aList).setType(getType().getSymmetricType());
    }
    return new SymmetricRelationship(getType(), list, getSourceSynset(), getTargetSynset());
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:8,代码来源:SymmetricRelationship.java


示例18: AsymmetricRelationship

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
public AsymmetricRelationship(
        PointerType type, PointerTargetNodeList nodes, int commonParentIndex, Synset sourceSynset, Synset targetSynset) {

    super(type, nodes, sourceSynset, targetSynset);
    // fail fast
    nodes.get(commonParentIndex);
    this.commonParentIndex = commonParentIndex;
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:9,代码来源:AsymmetricRelationship.java


示例19: reverse

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


示例20: testConstructorAndGetters

import net.sf.extjwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
@Test
public void testConstructorAndGetters() throws JWNLException {
    dictionary.edit();
    Synset s1 = dictionary.createSynset(POS.NOUN);
    Synset s2 = dictionary.createSynset(POS.NOUN);
    SymmetricRelationship r =
            new SymmetricRelationship(PointerType.ANTONYM, new PointerTargetNodeList(
                    Arrays.asList(
                            new PointerTargetNode(s1, PointerType.ANTONYM),
                            new PointerTargetNode(s2, PointerType.ANTONYM)
                    )
            ), s1, s2);

    Assert.assertEquals(s1, r.getSourceSynset());
    Assert.assertEquals(s2, r.getTargetSynset());
    Assert.assertNotNull(r.toString());

    Assert.assertEquals(s1, r.getSourcePointerTarget());
    Assert.assertEquals(s2, r.getTargetSynset());

    SymmetricRelationship rr =
            new SymmetricRelationship(PointerType.ANTONYM, new PointerTargetNodeList(
                    Arrays.asList(
                            new PointerTargetNode(s2, PointerType.ANTONYM),
                            new PointerTargetNode(s1, PointerType.ANTONYM)
                    )
            ), s2, s1);

    Assert.assertTrue(rr.hashCode() != r.hashCode());
    Assert.assertTrue(!rr.equals(r));
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:32,代码来源:TestSymmetricRelationship.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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