Package org.apache.tika.parser.sentiment
Class SentimentAnalysisParser
java.lang.Object
org.apache.tika.parser.sentiment.SentimentAnalysisParser
- All Implemented Interfaces:
Serializable
,Initializable
,Parser
This parser classifies documents based on the sentiment of document.
The classifier is powered by Apache OpenNLP's Maximum Entropy Classifier
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
getSupportedTypes
(ParseContext context) Returns the types supportedvoid
initialize
(Map<String, Param> params) void
parse
(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) Performs the parse
-
Field Details
-
DEF_MODEL
- See Also:
-
-
Constructor Details
-
SentimentAnalysisParser
public SentimentAnalysisParser()
-
-
Method Details
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Parameters:
params
- params to use for initialization- Throws:
TikaConfigException
-
checkInitialization
- Specified by:
checkInitialization
in interfaceInitializable
- Parameters:
handler
- if there is a problem and no custom initializableProblemHandler has been configured via Initializable parameters, this is called to respond.- Throws:
TikaConfigException
-
getSupportedTypes
Returns the types supported- Specified by:
getSupportedTypes
in interfaceParser
- Parameters:
context
- the parse context- Returns:
- the set of types supported
-
parse
public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException Performs the parse- Specified by:
parse
in interfaceParser
- Parameters:
stream
- the inputhandler
- the content handlermetadata
- the metadata passedcontext
- the context for the parser- Throws:
IOException
- if the document stream could not be readSAXException
- if the SAX events could not be processedTikaException
- if the document could not be parsed
-