Search in sources :

Example 1 with OperationValue

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);
}
Also used : SentimentInformation(org.grupolys.samulan.util.SentimentInformation) ArrayList(java.util.ArrayList) OperationValue(org.grupolys.samulan.util.OperationValue)

Example 2 with OperationValue

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()));
    }
}
Also used : SentimentInformation(org.grupolys.samulan.util.SentimentInformation) OperationValue(org.grupolys.samulan.util.OperationValue)

Example 3 with OperationValue

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);
}
Also used : OperationValue(org.grupolys.samulan.util.OperationValue)

Example 4 with OperationValue

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);
}
Also used : SentimentInformation(org.grupolys.samulan.util.SentimentInformation) ArrayList(java.util.ArrayList) OperationValue(org.grupolys.samulan.util.OperationValue)

Example 5 with OperationValue

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);
}
Also used : OperationValue(org.grupolys.samulan.util.OperationValue)

Aggregations

OperationValue (org.grupolys.samulan.util.OperationValue)9 SentimentInformation (org.grupolys.samulan.util.SentimentInformation)6 ArrayList (java.util.ArrayList)5 QueuedOperationInformation (org.grupolys.samulan.util.QueuedOperationInformation)1