use of org.apache.solr.uima.ts.DummySentimentAnnotation in project lucene-solr by apache.
the class DummySentimentAnnotator method process.
@Override
public void process(JCas jcas) throws AnalysisEngineProcessException {
for (Annotation annotation : jcas.getAnnotationIndex(TokenAnnotation.type)) {
String tokenPOS = ((TokenAnnotation) annotation).getPosTag();
if ("jj".equals(tokenPOS)) {
if (Arrays.asList(positiveAdj).contains(annotation.getCoveredText())) {
DummySentimentAnnotation dummySentimentAnnotation = createSentimentAnnotation(jcas, annotation);
dummySentimentAnnotation.setMood("positive");
dummySentimentAnnotation.addToIndexes();
} else if (Arrays.asList(negativeAdj).contains(annotation.getCoveredText())) {
DummySentimentAnnotation dummySentimentAnnotation = createSentimentAnnotation(jcas, annotation);
dummySentimentAnnotation.setMood("negative");
dummySentimentAnnotation.addToIndexes();
}
}
}
}
use of org.apache.solr.uima.ts.DummySentimentAnnotation in project lucene-solr by apache.
the class DummySentimentAnnotator method createSentimentAnnotation.
private DummySentimentAnnotation createSentimentAnnotation(JCas jcas, Annotation annotation) {
DummySentimentAnnotation dummySentimentAnnotation = new DummySentimentAnnotation(jcas);
dummySentimentAnnotation.setBegin(annotation.getBegin());
dummySentimentAnnotation.setEnd(annotation.getEnd());
return dummySentimentAnnotation;
}
Aggregations