當前位置: 首頁>>代碼示例>>Java>>正文


Java PointerTargetTreeNodeList類代碼示例

本文整理匯總了Java中net.didion.jwnl.data.list.PointerTargetTreeNodeList的典型用法代碼示例。如果您正苦於以下問題:Java PointerTargetTreeNodeList類的具體用法?Java PointerTargetTreeNodeList怎麽用?Java PointerTargetTreeNodeList使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PointerTargetTreeNodeList類屬於net.didion.jwnl.data.list包,在下文中一共展示了PointerTargetTreeNodeList類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findSymmetricRelationships

import net.didion.jwnl.data.list.PointerTargetTreeNodeList; //導入依賴的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;
}
 
開發者ID:duguyue100,項目名稱:chomsky,代碼行數:26,代碼來源:RelationshipFinder.java

示例2: makeInheritedTreeList

import net.didion.jwnl.data.list.PointerTargetTreeNodeList; //導入依賴的package包/類
/**
 * Turn an existing tree list into an inheritance tree list.
 * @param list the tree list to convert
 * @param searchTypes the pointer types to include in the pointer lists
 * @param labelType the <code>PointerType</code> with which to label each pointer
 * @param pointerDepth the depth to which to search for each pointer list
 * @param ancestorDepth the depth to which to go to in <code>tree</code>
 * @param allowRedundancies if true, duplicate items are allowed in the list
 */
public PointerTargetTreeNodeList makeInheritedTreeList(PointerTargetTreeNodeList list,
                                                       PointerType[] searchTypes, PointerType labelType,
                                                       int pointerDepth, int ancestorDepth,
                                                       boolean allowRedundancies) throws JWNLException {
	ancestorDepth--;
	PointerTargetTreeNodeList inherited = new PointerTargetTreeNodeList();
	for (Iterator itr = list.iterator(); itr.hasNext();) {
		PointerTargetTreeNode node = (PointerTargetTreeNode) itr.next();
		if (allowRedundancies || !inherited.contains(node)) {
			if (ancestorDepth == 0) {
				inherited.add(node.getPointerTarget(),
				              null,
				              makePointerTargetTreeList(node.getSynset(), searchTypes, labelType, pointerDepth, allowRedundancies),
				              PointerType.HYPERNYM);
			} else {
				inherited.add(node.getPointerTarget(),
				              makeInheritedTreeList(node.getChildTreeList(), searchTypes, labelType,
				                                    pointerDepth, ancestorDepth, allowRedundancies),
				              makePointerTargetTreeList(node.getSynset(), searchTypes, labelType, pointerDepth, allowRedundancies),
				              PointerType.HYPERNYM);
			}
		}
	}
	return inherited;
}
 
開發者ID:duguyue100,項目名稱:chomsky,代碼行數:35,代碼來源:PointerUtils.java

示例3: getSetOfSynsets

import net.didion.jwnl.data.list.PointerTargetTreeNodeList; //導入依賴的package包/類
/**
 * Harvest all the synsets from this {@link PointerTargetTreeNodeList}, iteratively and recursively. Each treeNode holds a synset, and a pointer to a child list 
 * of treeNodes.
 * 
 * @param pointerTargetTreeList must not be null!
 * @return
 * @throws WordNetException 
 */
protected Set<Synset> getSetOfSynsets(PointerTargetTreeNodeList pointerTargetTreeList) throws WordNetException {
	Set<Synset> ret = new HashSet<Synset>();
	for (Object treeNodeAsObject : pointerTargetTreeList)
	{
		if (!(treeNodeAsObject instanceof PointerTargetTreeNode))
			throw new WordNetException("Internal error. this was supposed to be a PointerTargetTreeNodeList: " + pointerTargetTreeList);
		PointerTargetTreeNode treeNode = (PointerTargetTreeNode) treeNodeAsObject;
		ret.add(new JwnlSynset(jwnlDictionary, treeNode.getSynset()));
		if (treeNode.hasValidChildTreeList())
			ret.addAll(getSetOfSynsets(treeNode.getChildTreeList()));
	}
	return ret;
}
 
開發者ID:hltfbk,項目名稱:Excitement-TDMLEDA,代碼行數:22,代碼來源:JwnlSynset.java

示例4: getExtendedAntonyms

import net.didion.jwnl.data.list.PointerTargetTreeNodeList; //導入依賴的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));
}
 
開發者ID:duguyue100,項目名稱:chomsky,代碼行數:10,代碼來源:PointerUtils.java

示例5: getIndirectAntonyms

import net.didion.jwnl.data.list.PointerTargetTreeNodeList; //導入依賴的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));
}
 
開發者ID:duguyue100,項目名稱:chomsky,代碼行數:10,代碼來源:PointerUtils.java

示例6: makePointerTargetTreeList

import net.didion.jwnl.data.list.PointerTargetTreeNodeList; //導入依賴的package包/類
/**
 * Make a nested list of pointer targets to depth <var>depth</var>, starting at <code>synset</code>. Each
 * level of the list is related to the previous level by a pointer of type <var>searchType</var>.
 * @param labelType the type used to label each pointer target in the tree
 * @param allowRedundancies if true, duplicate items will be included in the tree
 */
public PointerTargetTreeNodeList makePointerTargetTreeList(Synset set, PointerType searchType,
                                                           PointerType labelType, int depth,
                                                           boolean allowRedundancies) throws JWNLException {
	PointerType[] searchTypes = new PointerType[1];
	searchTypes[0] = searchType;
	return makePointerTargetTreeList(set, searchTypes, labelType, depth, allowRedundancies);
}
 
開發者ID:duguyue100,項目名稱:chomsky,代碼行數:14,代碼來源:PointerUtils.java


注:本文中的net.didion.jwnl.data.list.PointerTargetTreeNodeList類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。