Package opennlp.tools.sentiment
Class SentimentCrossValidator
java.lang.Object
opennlp.tools.sentiment.SentimentCrossValidator
Class for performing cross validation on the Sentiment Analysis Parser.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classClass for creating a document sampleprivate static classSplits DocumentSample into SentimentSamples.private static classReads Sentiment Samples to group them as a document based on the clear adaptive data flag. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SentimentFactoryprivate final FMeasureprivate final Stringprivate final SentimentEvaluationMonitor[]private final TrainingParameters -
Constructor Summary
ConstructorsConstructorDescriptionSentimentCrossValidator(String lang, TrainingParameters params, SentimentFactory factory, SentimentEvaluationMonitor[] monitors) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidevaluate(ObjectStream<SentimentSample> samples, int nFolds) Performs evaluationReturns the F-Measure
-
Field Details
-
languageCode
-
params
-
listeners
-
factory
-
fmeasure
-
-
Constructor Details
-
SentimentCrossValidator
public SentimentCrossValidator(String lang, TrainingParameters params, SentimentFactory factory, SentimentEvaluationMonitor[] monitors) Constructor
-
-
Method Details
-
evaluate
Performs evaluation- Parameters:
samples- stream of SentimentSamplesnFolds- the number of folds to be used in cross validation- Throws:
IOException
-
getFMeasure
Returns the F-Measure- Returns:
- the F-Measure
-