Class SentimentAnalysisParser

  • All Implemented Interfaces:
    java.io.Serializable, Initializable, Parser

    public class SentimentAnalysisParser
    extends AbstractParser
    implements Initializable
    This parser classifies documents based on the sentiment of document. The classifier is powered by Apache OpenNLP's Maximum Entropy Classifier
    See Also:
    Serialized Form
    • Constructor Detail

      • SentimentAnalysisParser

        public SentimentAnalysisParser()
    • Method Detail

      • getSupportedTypes

        public java.util.Set<MediaType> getSupportedTypes​(ParseContext context)
        Returns the types supported
        Specified by:
        getSupportedTypes in interface Parser
        Parameters:
        context - the parse context
        Returns:
        the set of types supported
      • parse

        public void parse​(java.io.InputStream stream,
                          org.xml.sax.ContentHandler handler,
                          Metadata metadata,
                          ParseContext context)
                   throws java.io.IOException,
                          org.xml.sax.SAXException,
                          TikaException
        Performs the parse
        Specified by:
        parse in interface Parser
        Parameters:
        stream - the input
        handler - the content handler
        metadata - the metadata passed
        context - the context for the parser
        Throws:
        java.io.IOException - if the document stream could not be read
        org.xml.sax.SAXException - if the SAX events could not be processed
        TikaException - if the document could not be parsed