Class SentimentAnalysisParser

  • All Implemented Interfaces:
    Serializable, org.apache.tika.config.Initializable, org.apache.tika.parser.Parser

    public class SentimentAnalysisParser
    extends org.apache.tika.parser.AbstractParser
    implements org.apache.tika.config.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

      • initialize

        public void initialize​(Map<String,​org.apache.tika.config.Param> params)
                        throws org.apache.tika.exception.TikaConfigException
        Specified by:
        initialize in interface org.apache.tika.config.Initializable
        Throws:
        org.apache.tika.exception.TikaConfigException
      • checkInitialization

        public void checkInitialization​(org.apache.tika.config.InitializableProblemHandler handler)
                                 throws org.apache.tika.exception.TikaConfigException
        Specified by:
        checkInitialization in interface org.apache.tika.config.Initializable
        Throws:
        org.apache.tika.exception.TikaConfigException
      • getSupportedTypes

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

        public void parse​(InputStream stream,
                          ContentHandler handler,
                          org.apache.tika.metadata.Metadata metadata,
                          org.apache.tika.parser.ParseContext context)
                   throws IOException,
                          SAXException,
                          org.apache.tika.exception.TikaException
        Performs the parse
        Specified by:
        parse in interface org.apache.tika.parser.Parser
        Parameters:
        stream - the input
        handler - the content handler
        metadata - the metadata passed
        context - the context for the parser
        Throws:
        IOException
        SAXException
        org.apache.tika.exception.TikaException