Package org.apache.solr.uima.ts

Examples of org.apache.solr.uima.ts.SentimentAnnotation


  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())) {
          SentimentAnnotation sentimentAnnotation = createSentimentAnnotation(jcas, annotation);
          sentimentAnnotation.setMood("positive");
          sentimentAnnotation.addToIndexes();
        }
        else if (Arrays.asList(negativeAdj).contains(annotation.getCoveredText())) {
          SentimentAnnotation sentimentAnnotation = createSentimentAnnotation(jcas, annotation);
          sentimentAnnotation.setMood("negative");
          sentimentAnnotation.addToIndexes();
        }
      }
    }
  }
View Full Code Here


      }
    }
  }

  private SentimentAnnotation createSentimentAnnotation(JCas jcas, Annotation annotation) {
    SentimentAnnotation sentimentAnnotation = new SentimentAnnotation(jcas);
    sentimentAnnotation.setBegin(annotation.getBegin());
    sentimentAnnotation.setEnd(annotation.getEnd());
    return sentimentAnnotation;
  }
View Full Code Here

TOP

Related Classes of org.apache.solr.uima.ts.SentimentAnnotation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.