Package org.apache.uima.alchemy.ts.sentiment

Examples of org.apache.uima.alchemy.ts.sentiment.SentimentFS


      JCas sentimentJCas = TestUtils.executeAE(TestUtils.getAE(xmlPath, parameterSettings), doc);
      List<SentimentFS> sentimentList = (List<SentimentFS>) TestUtils.getAllFSofType(
              SentimentFS.type, sentimentJCas);
      assertTrue(sentimentList != null);
      assertTrue(sentimentList.size() == 1);
      SentimentFS sentimentFS = sentimentList.get(0);
      assertTrue(sentimentFS != null);
      assertTrue(sentimentFS.getSentimentType() != null
              && "negative".equals(sentimentFS.getSentimentType()));
      assertTrue(sentimentFS.getScore() != null && Double.valueOf(sentimentFS.getScore()) < 0);
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.toString());
    }
  }
View Full Code Here


public class SentimentAnalysisProcessor implements AlchemyOutputProcessor {

  public void process(JCas cas, Results results) throws Exception {
    DocumentSentiment docSentiment = ((SentimentAnalysisResults) results).getDocSentiment();
    if (docSentiment != null) {
      SentimentFS sentimentFS = new SentimentFS(cas);
      sentimentFS.setScore(docSentiment.getScore());
      sentimentFS.setSentimentType(docSentiment.getType());
      sentimentFS.addToIndexes();
    }
  }
View Full Code Here

            i++;
          }
          fs.setFeatureValue(type.getFeatureByBaseName("quotations"), quotationsFeatureStructure);
        }
        if (entity.getSentiment() != null) {
          SentimentFS sentimentFS = new SentimentFS(cas);
          sentimentFS.setScore(entity.getSentiment().getScore());
          sentimentFS.setSentimentType(entity.getSentiment().getType());
          sentimentFS.addToIndexes();
          fs.setFeatureValue(type.getFeatureByBaseName("sentiment"), sentimentFS);
        }
        cas.addFsToIndexes(fs);
        /* build annotations on this fs */
        buildAnnotations(cas, fs);
View Full Code Here

TOP

Related Classes of org.apache.uima.alchemy.ts.sentiment.SentimentFS

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.