"Sentiment" (Built-in Classifier)
Determine the sentiment of a text from a snippet.
Classes
Details
- This classifier attempts to infer the sentiment that a snippet of text conveys.
- The input text should typically be one or a few sentences.
- This classifier assumes the text conveys only one sentiment. The probabilities reflect the belief in these sentiments, not the proportion of sentiments.
- The current version only works for the English language.
Examples
open all close allBasic Examples (2)
Use the "Sentiment" built-in classifier to infer the sentiment of a review:
Classify["Sentiment", "I enjoy working in this company"]Classify["Sentiment", {"I am so sad", "My phone broke again", "I love this movie"}]Obtain the probabilities for the possible classes:
Classify["Sentiment", "There is nothing good about the fellas in this movie", "Probabilities"]Obtain a ClassifierFunction for this classifier:
c = Classify["Sentiment"]Apply the classifier to a list of examples:
c[{"I love this movie", "I am so sad", "My phone broke again"}]Scope (1)
Load the ClassifierFunction corresponding to the built-in classifier:
c = Classify["Sentiment"]Information[c, "Classes"]Options (2)
ClassPriors (1)
Use a custom ClassPriors to restrict the possible outputs:
Classify["Sentiment", "There is nothing good about the fellas in this movie", ClassPriors -> <|"Negative" -> 0.5, "Neutral" -> 0.5|>]IndeterminateThreshold (1)
Use a custom IndeterminateThreshold:
Classify["Sentiment", "There is nothing good about the fellas in this movie", IndeterminateThreshold -> 0.7]See Also
Classify NetModel TextRecognize TextCases TextSentences WolframLanguageData Snippet
Classifiers: FacebookTopic Language
Related Guides
History
Introduced in 2018 (11.3)