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


Java PointerTargetNodeList类代码示例

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


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


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