Considere o código Python a seguir:
import nltk
from nltk.sentiment import SentimentIntensityAnalyzer
s = SentimentIntensityAnalyzer()
frase = "Hoje estou animado"
resultado = s.polarity_scores(frase)
print("Sentimento:", resultado)
Executado em condições ideais, a saída será semelhante a:
import nltk
from nltk.sentiment import SentimentIntensityAnalyzer
s = SentimentIntensityAnalyzer()
frase = "Hoje estou animado"
resultado = s.polarity_scores(frase)
print("Sentimento:", resultado)
Executado em condições ideais, a saída será semelhante a:
- A)Sentimento: {'positive'}
- B)Sentimento: {'negative': 0.0, 'positive': 1}
- C)Sentimento: {'neg': 0.0, 'neu': 0.318, 'pos': 0.682, 'compound': 0.4588}
- D)Sentimento: {'negative': 0.1, 'positive': 0,4588, 'average': 0.2794}
- E)Sentimento: {'positive':no, 'positive':yes}