Tree binarized = sentence.get(TreeCoreAnnotations.BinarizedTreeAnnotation.class);
if (binarized == null) {
throw new AssertionError("Binarized sentences not built by parser");
}
Tree collapsedUnary = transformer.transformTree(binarized);
SentimentCostAndGradient scorer = new SentimentCostAndGradient(model, null);
scorer.forwardPropagateTree(collapsedUnary);
sentence.set(SentimentCoreAnnotations.AnnotatedTree.class, collapsedUnary);
int sentiment = RNNCoreAnnotations.getPredictedClass(collapsedUnary);
sentence.set(SentimentCoreAnnotations.ClassName.class, SentimentUtils.sentimentString(model, sentiment));
}
} else {