The SentimentExtractor function extracts the sentiment (positive, negative, or neutral) of each input document or sentence, using either a classification model output by the function SentimentTrainer or a dictionary model.
The dictionary model consists of WordNet, a lexical database of the English language, and these negation words:
The function handles negated sentiments as follows:
- -1 if the sentiment is negated (for example, "I am not happy")
- -1 if the sentiment and a negation word are separated by one word (for example, "I am not very happy")
- +1 if the sentiment and a negation word are separated by two or more words (for example, "I am not saying I am happy")