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


Java Example.getRepresentation方法代码示例

本文整理汇总了Java中it.uniroma2.sag.kelp.data.example.Example.getRepresentation方法的典型用法代码示例。如果您正苦于以下问题:Java Example.getRepresentation方法的具体用法?Java Example.getRepresentation怎么用?Java Example.getRepresentation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在it.uniroma2.sag.kelp.data.example.Example的用法示例。


在下文中一共展示了Example.getRepresentation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractRepresentation

import it.uniroma2.sag.kelp.data.example.Example; //导入方法依赖的package包/类
/**
 * Given an Example, extracts the object related to the given representation
 * (determined at construction time of class <code>SelectRepresentationFromExample</code>).
 *   
 * @param example a KeLP Example
 * @return an Object related to the given representation. It is the duty of
 * the invoking class to cast the object to the appropriate class. 
 */
public Object extractRepresentation(Example example) {
	if(example instanceof ExamplePair){
		ExamplePair pair = (ExamplePair)example;
		if(representationSelector == representationSelectorInExample.LEFT) {
			return pair.getLeftExample().getRepresentation(representation);
		}else if(representationSelector == representationSelectorInExample.RIGHT){
			return pair.getRightExample().getRepresentation(representation);
		}
		/* representationSelector == representationSelectorInExample.ALL, 
		 * which means that both trees need to be selected. They will 
		 * be selected when the manipulator is invoked for each Example of 
		 * Example Pair, not now*/ 
	} else if(example instanceof Example){
		if(representationSelector == representationSelectorInExample.ALL) {
			return example.getRepresentation(representation);
		}
	}
	return null;
}
 
开发者ID:SAG-KeLP,项目名称:kelp-additional-kernels,代码行数:28,代码来源:SelectRepresentationFromExample.java

示例2: manipulate

import it.uniroma2.sag.kelp.data.example.Example; //导入方法依赖的package包/类
@Override
public void manipulate(Example example) {
	TreeRepresentation repr = (TreeRepresentation) example
			.getRepresentation(representationToBeEnriched);
	if (repr != null)
		enrichTreeWithCompositionalProduct(repr);
}
 
开发者ID:SAG-KeLP,项目名称:kelp-additional-kernels,代码行数:8,代码来源:CompositionalNodeSimilarityProduct.java

示例3: manipulate

import it.uniroma2.sag.kelp.data.example.Example; //导入方法依赖的package包/类
@Override
public void manipulate(Example example) {
	TreeRepresentation repr = (TreeRepresentation) example
			.getRepresentation(representationToBeEnriched);
	if (repr != null)
		enrichTreeWithCompositionalDilation(repr);
}
 
开发者ID:SAG-KeLP,项目名称:kelp-additional-kernels,代码行数:8,代码来源:CompositionalNodeSimilarityDilation.java

示例4: manipulate

import it.uniroma2.sag.kelp.data.example.Example; //导入方法依赖的package包/类
@Override
public void manipulate(Example example) {
	TreeRepresentation repr = (TreeRepresentation) example
			.getRepresentation(representationToBeEnriched);
	if (repr != null)
		enrichTreeWithCompositionalSum(repr);
}
 
开发者ID:SAG-KeLP,项目名称:kelp-additional-kernels,代码行数:8,代码来源:CompositionalNodeSimilaritySum.java

示例5: manipulate

import it.uniroma2.sag.kelp.data.example.Example; //导入方法依赖的package包/类
@Override
public void manipulate(Example example) {
	TreeRepresentation tree = (TreeRepresentation) example.getRepresentation(representationToBeEnriched);
	if(tree!=null){
		enrichTreeRepresentation(tree, wordSpace, enrichmentName);
	}

}
 
开发者ID:SAG-KeLP,项目名称:kelp-additional-kernels,代码行数:9,代码来源:LexicalStructureElementManipulator.java

示例6: manipulate

import it.uniroma2.sag.kelp.data.example.Example; //导入方法依赖的package包/类
@Override
public void manipulate(Example example) {
	DirectedGraphRepresentation g = (DirectedGraphRepresentation) example.getRepresentation(this.graphRepresentation);
	if(g==null){
		return;
	}
	SparseVector featureVector = new SparseVector();
	List<GraphNode> nodeList = g.getNodeList();
	int nnodes = nodeList.size();
	int[] newlabels = new int[nnodes];
	int tmpLabel;
	//relabel nodes as integers, so that the relabeling function is always int -> int
	for (int i=0; i<nnodes; i+=1) {
		featureVector.incrementFeature(String.valueOf(mapNodeLabelToInt(nodeList.get(i))), 1.0f);
	}

	for (int l=1; l <= this.h; l++) {
		for (int i=0; i<nnodes; i++) {
			tmpLabel = relabelNode(nodeList.get(i));
			if (tmpLabel > -1 && tmpLabel != this.getContentHash(nodeList.get(i))) {
				newlabels[i] = tmpLabel;	
				featureVector.incrementFeature(String.valueOf(newlabels[i]), 1.0f);
			}
		}
		//write the new labels in the GraphNode Object  
		for (int i=0; i<nnodes; i+=1) {
			this.setContentHash(nodeList.get(i), newlabels[i]);
		}
	}
	example.addRepresentation(vectorRepresentation, featureVector);
	
}
 
开发者ID:SAG-KeLP,项目名称:kelp-additional-kernels,代码行数:33,代码来源:WLSubtreeMapper.java


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