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:
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
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEF_MODEL
-
Constructor Summary
Constructors Constructor Description SentimentAnalysisParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkInitialization(InitializableProblemHandler handler)
java.util.Set<MediaType>
getSupportedTypes(ParseContext context)
Returns the types supportedvoid
initialize(java.util.Map<java.lang.String,Param> params)
void
parse(java.io.InputStream stream, org.xml.sax.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 java.lang.String DEF_MODEL
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(java.util.Map<java.lang.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 java.util.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(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 interfaceParser
- Parameters:
stream
- the inputhandler
- the content handlermetadata
- the metadata passedcontext
- the context for the parser- Throws:
java.io.IOException
- if the document stream could not be readorg.xml.sax.SAXException
- if the SAX events could not be processedTikaException
- if the document could not be parsed
-
-