public class SimpleSentiment
extends java.lang.Object
SentimentPipeline
.Modifier and Type | Method and Description |
---|---|
SentimentClass |
classify(CoreMap sentence)
Get the sentiment of a sentence.
|
SentimentClass |
classify(java.lang.String text) |
static void |
main(java.lang.String[] args) |
static SimpleSentiment |
train(java.util.stream.Stream<edu.stanford.nlp.sentiment.SimpleSentiment.SentimentDatum> data,
java.util.Optional<java.io.OutputStream> modelLocation)
Train a sentiment model from a set of data.
|
public SentimentClass classify(CoreMap sentence)
sentence
- The sentence as a core map.
POS tags and Lemmas are a prerequisite.
See CoreAnnotations.PartOfSpeechAnnotation
and
CoreAnnotations.LemmaAnnotation
.public SentimentClass classify(java.lang.String text)
classify(CoreMap)
public static SimpleSentiment train(java.util.stream.Stream<edu.stanford.nlp.sentiment.SimpleSentiment.SentimentDatum> data, java.util.Optional<java.io.OutputStream> modelLocation)
data
- The data to train the model from.modelLocation
- An optional location to save the model.
Note that this stream will be closed in this method,
and should not be written to thereafter.public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException