本文整理汇总了Java中net.didion.jwnl.data.list.PointerTargetNodeList类的典型用法代码示例。如果您正苦于以下问题:Java PointerTargetNodeList类的具体用法?Java PointerTargetNodeList怎么用?Java PointerTargetNodeList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PointerTargetNodeList类属于net.didion.jwnl.data.list包,在下文中一共展示了PointerTargetNodeList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: findAsymmetricRelationships
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
/**
* Finds the asymmetric relationship(s) between two words. A relationship is
* asymmetric if its type is asymmetric (i.e. it's not its own inverse).
*/
private RelationshipList findAsymmetricRelationships(
Synset sourceSynset, Synset targetSynset, PointerType type, int depth) throws JWNLException {
// We run the reversal function on the trees to get linear (non-branching)
// paths from the source word to its deepest ancestor (i.e. if there are
// multiple relations from a single word anywhere in the path, the reversal
// function will break them down into multiple, linear paths).
PointerTargetNodeList[] sourceRelations = new PointerTargetTree(
sourceSynset, PointerUtils.getInstance().makePointerTargetTreeList(sourceSynset, type, depth)).reverse();
PointerTargetNodeList[] targetRelations = new PointerTargetTree(
targetSynset, PointerUtils.getInstance().makePointerTargetTreeList(targetSynset, type, depth)).reverse();
RelationshipList relationships = new RelationshipList();
// Do an exhaustive search for relationships
for (int i = 0; i < sourceRelations.length; i++) {
for (int j = 0; j < targetRelations.length; j++) {
Relationship relationship = findAsymmetricRelationship(
sourceRelations[i], targetRelations[j], type, sourceSynset, targetSynset);
if (relationship != null) {
relationships.add(relationship);
}
}
}
return relationships;
}
示例3: findSymmetricRelationships
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
/** A symmetric relationship is one whose type is symmetric (i.e. is it's own inverse). */
private RelationshipList findSymmetricRelationships(
final Synset sourceSynset, final Synset targetSynset, PointerType type, int depth) throws JWNLException {
PointerTargetTree tree = new PointerTargetTree(
sourceSynset, PointerUtils.getInstance().makePointerTargetTreeList(sourceSynset, type, null, depth, false));
PointerTargetTreeNodeList.Operation opr = new PointerTargetTreeNodeList.Operation() {
public Object execute(PointerTargetTreeNode testNode) {
if (targetSynset.equals(testNode.getSynset())) {
return testNode;
}
return null;
}
};
List l = tree.getAllMatches(opr);
RelationshipList list = new RelationshipList();
for (int i = 0; i < l.size(); i++) {
PointerTargetNodeList nodes = findSymmetricRelationship((PointerTargetTreeNode)l.get(i), type);
list.add(new SymmetricRelationship(type, nodes, sourceSynset, targetSynset));
}
return list;
}
示例4: getVerbGroup
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的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;
}
示例5: getSetOfSynsets
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的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;
}
示例6: 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;
}
示例7: getHyponymSynsets
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static Synset[] getHyponymSynsets(Synset synset) {
PointerTargetNodeList hyponyms = null;
try {
hyponyms = PointerUtils.getInstance().getDirectHyponyms(synset);
} catch (JWNLException e) {}
if (hyponyms == null) return null;
return getSynsets(hyponyms);
}
示例8: getEntailingSynsets
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static Synset[] getEntailingSynsets(Synset synset) {
PointerTargetNodeList entailing = null;
try {
entailing = PointerUtils.getInstance().getEntailments(synset);
} catch (JWNLException e) {}
if (entailing == null) return null;
return getSynsets(entailing);
}
示例9: getCausingSynsets
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static Synset[] getCausingSynsets(Synset synset) {
PointerTargetNodeList causing = null;
try {
causing = PointerUtils.getInstance().getCauses(synset);
} catch (JWNLException e) {}
if (causing == null) return null;
return getSynsets(causing);
}
示例10: getMemberOfSynsets
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static Synset[] getMemberOfSynsets(Synset synset) {
PointerTargetNodeList membersOf = null;
try {
membersOf = PointerUtils.getInstance().getMemberHolonyms(synset);
} catch (JWNLException e) {}
if (membersOf == null) return null;
return getSynsets(membersOf);
}
示例11: getSubstanceOfSynsets
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static Synset[] getSubstanceOfSynsets(Synset synset) {
PointerTargetNodeList substancesOf = null;
try {
substancesOf = PointerUtils.getInstance().getSubstanceHolonyms(synset);
} catch (JWNLException e) {}
if (substancesOf == null) return null;
return getSynsets(substancesOf);
}
示例12: getPartOfSynsets
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static Synset[] getPartOfSynsets(Synset synset) {
PointerTargetNodeList partsOf = null;
try {
partsOf = PointerUtils.getInstance().getPartHolonyms(synset);
} catch (JWNLException e) {}
if (partsOf == null) return null;
return getSynsets(partsOf);
}
示例13: getHasMemberSynsets
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static Synset[] getHasMemberSynsets(Synset synset) {
PointerTargetNodeList haveMember = null;
try {
haveMember = PointerUtils.getInstance().getMemberMeronyms(synset);
} catch (JWNLException e) {}
if (haveMember == null) return null;
return getSynsets(haveMember);
}
示例14: getHasSubstanceSynsets
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static Synset[] getHasSubstanceSynsets(Synset synset) {
PointerTargetNodeList haveSubstance = null;
try {
haveSubstance = PointerUtils.getInstance().getSubstanceMeronyms(synset);
} catch (JWNLException e) {}
if (haveSubstance == null) return null;
return getSynsets(haveSubstance);
}
示例15: getHasPartSynsets
import net.didion.jwnl.data.list.PointerTargetNodeList; //导入依赖的package包/类
private static Synset[] getHasPartSynsets(Synset synset) {
PointerTargetNodeList havePart = null;
try {
havePart = PointerUtils.getInstance().getPartMeronyms(synset);
} catch (JWNLException e) {}
if (havePart == null) return null;
return getSynsets(havePart);
}