use of org.grupolys.samulan.util.OperationValue in project uuusa by aghie.
the class BranchStrategy method apply.
public OperationValue apply(SentimentInformation head, List<SentimentInformation> children, Operation operation) {
List<SentimentInformation> newChildren = new ArrayList<SentimentInformation>();
SentimentInformation auxChild;
boolean branchFound = false;
for (SentimentInformation siChild : children) {
String deprel = siChild.getSentimentDependencyNode().getDeprel();
auxChild = new SentimentInformation(siChild);
if (deprel.equals(this.scope)) {
operation.updateSentiment(auxChild);
branchFound = true;
}
newChildren.add(auxChild);
}
if (!branchFound)
return null;
return new OperationValue(new SentimentInformation(head), newChildren);
}
use of org.grupolys.samulan.util.OperationValue in project uuusa by aghie.
the class HeadStrategy method apply.
public OperationValue apply(SentimentInformation head, List<SentimentInformation> children, Operation operation) {
SentimentInformation auxHead;
if (head.getSemanticOrientation() == 0 && !this.negateObjective) {
return null;
} else {
auxHead = new SentimentInformation(head);
operation.updateSentiment(auxHead);
return new OperationValue(auxHead, children.stream().map((SentimentInformation c) -> (new SentimentInformation(c))).collect(Collectors.toList()));
}
}
use of org.grupolys.samulan.util.OperationValue in project uuusa by aghie.
the class ShiftOperation method apply.
public OperationValue apply(SentimentInformation head, List<SentimentInformation> children) {
OperationValue ov = this.getStrategy().apply(head, children, this);
// System.out.println("ShiftOperation ov: "+ov);
if (ov != null) {
ov.setAppliedOperation(this);
ov.setAppliedStrategy(this.getStrategy());
return ov;
}
return delegate(head, children);
}
use of org.grupolys.samulan.util.OperationValue in project uuusa by aghie.
the class ChildrenStrategy method apply.
public OperationValue apply(SentimentInformation head, List<SentimentInformation> children, Operation operation) {
// TODO this is different from the original behaviour of the unsupervised system
List<SentimentInformation> newChildren = new ArrayList<SentimentInformation>();
SentimentInformation auxChild;
SentimentInformation auxHead = new SentimentInformation(head);
for (SentimentInformation siChild : children) {
// TODO still not doing what it is supposed to do
// copy constructor
auxChild = new SentimentInformation(siChild);
newChildren.add(auxChild);
}
operation.updateSentiment(auxHead);
return new OperationValue(auxHead, newChildren);
}
use of org.grupolys.samulan.util.OperationValue in project uuusa by aghie.
the class WeightingOperation method apply.
//
//
public OperationValue apply(SentimentInformation head, List<SentimentInformation> children) {
OperationValue ov = this.getStrategy().apply(head, children, this);
// System.out.println("ShiftOperation ov: "+ov);
if (ov != null) {
ov.setAppliedOperation(this);
ov.setAppliedStrategy(this.getStrategy());
return ov;
}
return delegate(head, children);
}
Aggregations