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.

OpenersPrimaryExamplesSection(Spacer1)Examples  (5)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Use the "Sentiment" built-in classifier to infer the sentiment of a review:

Classify["Sentiment", "I enjoy working in this company"]

Classify multiple examples:

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 (RefLink[ClassifierFunction, paclet:ref/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"}]

OpenersExampleSection1(Spacer1)Scope  (1)

Load the (RefLink[ClassifierFunction, paclet:ref/ClassifierFunction]) corresponding to the built-in classifier:

c=Classify["Sentiment"]

Obtain the possible classes:

Information[c,"Classes"]

OpenersExampleSection2(Spacer1)Options  (2)

OpenersExampleSubsection0(Spacer1)ClassPriors  (1)

Use a custom (RefLink[ClassPriors, paclet:ref/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|>]

OpenersExampleSubsection1(Spacer1)IndeterminateThreshold  (1)

Use a custom (RefLink[IndeterminateThreshold, paclet:ref/IndeterminateThreshold]):

Classify["Sentiment", "There is nothing good about the fellas in this movie",IndeterminateThreshold->0.7]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Classify, paclet:ref/Classify])  ▪  (RefLink[NetModel, paclet:ref/NetModel])  ▪  (RefLink[TextRecognize, paclet:ref/TextRecognize])  ▪  (RefLink[TextCases, paclet:ref/TextCases])  ▪  (RefLink[TextSentences, paclet:ref/TextSentences])  ▪  (RefLink[WolframLanguageData, paclet:ref/WolframLanguageData])  ▪  (RefLink[Snippet, paclet:ref/Snippet])}, {Related Classifiers:  (RefLink[FacebookTopic, paclet:ref/classifier/FacebookTopic])  ▪  (RefLink[Language, paclet:ref/classifier/Language])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/22-machine-learning.html])(WebLink[: Machine Learning, https://www.wolfram.com/language/elementary-introduction/22-machine-learning.html])}, {(WebLink[DocumentationFooterIconsRelatedLinks-NeuralNetRepository.png(Spacer1)Wolfram Neural Net Repository, https://resources.wolframcloud.com/NeuralNetRepository/])}, {(Spacer1)▪(RefLinkPlain[(Spacer1)Machine Learning, paclet:guide/MachineLearning])}})}})