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