Package org.apache.tika.parser.sentiment
Class SentimentAnalysisParser
- java.lang.Object
-
- org.apache.tika.parser.AbstractParser
-
- org.apache.tika.parser.sentiment.SentimentAnalysisParser
-
- All Implemented Interfaces:
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 Summary
Constructors Constructor Description SentimentAnalysisParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkInitialization(InitializableProblemHandler handler)
Set<MediaType>
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-
Methods inherited from class org.apache.tika.parser.AbstractParser
parse
-
-
-
-
Field Detail
-
DEF_MODEL
public static final String DEF_MODEL
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(Map<String,Param> params) throws TikaConfigException
- Specified by:
initialize
in interfaceInitializable
- Parameters:
params
- params to use for initialization- Throws:
TikaConfigException
-
checkInitialization
public void checkInitialization(InitializableProblemHandler handler) throws TikaConfigException
- 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
public Set<MediaType> getSupportedTypes(ParseContext context)
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
-
-