本文整理汇总了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);
}
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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);
}
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
}