本文整理汇总了Java中net.didion.jwnl.data.list.PointerTargetTree类的典型用法代码示例。如果您正苦于以下问题:Java PointerTargetTree类的具体用法?Java PointerTargetTree怎么用?Java PointerTargetTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PointerTargetTree类属于net.didion.jwnl.data.list包,在下文中一共展示了PointerTargetTree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findAsymmetricRelationships
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的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;
}
示例2: findSymmetricRelationships
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的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;
}
示例3: getExtendedAntonyms
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/** Find all antonyms of <code>synset</code>, and all synonyms of those antonyms to depth <code>depth</code>. */
public PointerTargetTree getExtendedAntonyms(Synset synset, int depth) throws JWNLException {
PointerTargetTreeNodeList list = new PointerTargetTreeNodeList();
if (synset.getPOS() == POS.ADJECTIVE) {
PointerTargetNodeList antonyms = getAntonyms(synset);
list = makePointerTargetTreeList(antonyms, PointerType.SIMILAR_TO, PointerType.ANTONYM, depth, false);
}
return new PointerTargetTree(new PointerTargetTreeNode(synset, list, null));
}
示例4: getIndirectAntonyms
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/** Get the antonyms of all words that mean the same as <code>synset</code> to depth <code>depth</code>.*/
public PointerTargetTree getIndirectAntonyms(Synset synset, int depth) throws JWNLException {
PointerTargetTreeNodeList list = new PointerTargetTreeNodeList();
if (synset.getPOS() == POS.ADJECTIVE) {
PointerTargetNodeList synonyms = getSynonyms(synset);
list = makePointerTargetTreeList(synonyms, PointerType.ANTONYM, PointerType.ANTONYM, depth, false);
}
return new PointerTargetTree(new PointerTargetTreeNode(synset, list, null));
}
示例5: getInheritedMeronyms
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/**
* Get meronyms of each synset, to depth <code>pointerDepth</code> starting at
* <code>synset</code> and going for all of <code>synset</code>'s ancestors to depth
* <code>ancestorDepth</code>.
*/
public PointerTargetTree getInheritedMeronyms(Synset synset, int pointerDepth, int ancestorDepth)
throws JWNLException {
PointerType[] types = new PointerType[3];
types[0] = PointerType.PART_MERONYM;
types[1] = PointerType.MEMBER_MERONYM;
types[2] = PointerType.SUBSTANCE_MERONYM;
return makeInheritedTree(synset, types, null, pointerDepth, ancestorDepth, false);
}
示例6: getInheritedHolonyms
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/**
* Get holonyms of each synset, to depth <code>pointerDepth</code>, starting at <code>synset</code>
* and going for all of <code>synset</code>'s ancestors to depth <code>ancestorDepth</code>.
*/
public PointerTargetTree getInheritedHolonyms(Synset synset, int pointerDepth, int ancestorDepth)
throws JWNLException {
PointerType[] types = new PointerType[3];
types[0] = PointerType.PART_HOLONYM;
types[1] = PointerType.MEMBER_HOLONYM;
types[2] = PointerType.SUBSTANCE_HOLONYM;
return makeInheritedTree(synset, types, null, pointerDepth, ancestorDepth, false);
}
示例7: makeInheritedTree
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/**
* Create a hypernym tree starting at <var>synset</var>, and add to each node a nested list pointer targets of type
* <var>searchType</var>, starting at the node's pointer target.
* @param pointerDepth the depth to which to search for each pointer list
* @param ancestorDepth the depth to which to go to in the hypernym list
* @param allowRedundancies if true, duplicate items are allowed in the list
*/
public PointerTargetTree makeInheritedTree(Synset synset, PointerType searchType, PointerType labelType,
int pointerDepth, int ancestorDepth, boolean allowRedundancies)
throws JWNLException {
PointerType[] searchTypes = new PointerType[1];
searchTypes[0] = searchType;
return makeInheritedTree(synset, searchTypes, labelType, pointerDepth, ancestorDepth, allowRedundancies);
}
示例8: print
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/**
* @param _tt
*/
@SuppressWarnings("unused")
private static void print(PointerTargetTree _tt) {
if (_tt.getRootNode() != null) {
System.out.println(_tt.getRootNode());
_tt.getRootNode().getChildTreeList().print();
}
}
示例9: demonstrateTreeOperation
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
private void demonstrateTreeOperation(IndexWord word) throws JWNLException {
// Get all the hyponyms (children) of the first sense of <var>word</var>
PointerTargetTree hyponyms = PointerUtils.getInstance().getHyponymTree(word.getSense(1));
System.out.println("Hyponyms of \"" + word.getLemma() + "\":");
hyponyms.print();
}
示例10: getHypernymTree
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/** Get all of the ancestors of <code>synset</code> */
public PointerTargetTree getHypernymTree(Synset synset) throws JWNLException {
return getHypernymTree(synset, INFINITY);
}
示例11: getHyponymTree
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/** Get all of the children of <code>synset</code> */
public PointerTargetTree getHyponymTree(Synset synset) throws JWNLException {
return getHyponymTree(synset, INFINITY);
}
示例12: getAlsoSeeTree
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/** Find all See Also relations to depth <code>depth</code>.*/
public PointerTargetTree getAlsoSeeTree(Synset synset, int depth) throws JWNLException {
return new PointerTargetTree(synset, makePointerTargetTreeList(synset, PointerType.SEE_ALSO, depth));
}
示例13: getInteritedMeronyms
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/** Get meronyms of <code>synset</code> and of all its ancestors */
public PointerTargetTree getInteritedMeronyms(Synset synset) throws JWNLException {
return getInheritedMeronyms(synset, INFINITY, INFINITY);
}
示例14: getInheritedPartMeronyms
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/** Get part meronyms of <code>synset</code> and of all its ancestors */
public PointerTargetTree getInheritedPartMeronyms(Synset synset) throws JWNLException {
return getInheritedPartMeronyms(synset, INFINITY, INFINITY);
}
示例15: getInheritedMemberMeronyms
import net.didion.jwnl.data.list.PointerTargetTree; //导入依赖的package包/类
/** Get member meronyms of synset and of its ancestors */
public PointerTargetTree getInheritedMemberMeronyms(Synset synset) throws JWNLException {
return getInheritedMemberMeronyms(synset, INFINITY, INFINITY);
}