Português >English v
SA is contextual mining of text which identifies and extracts subjective information in source material, and helping a business to understand the social sentiment of their brand, product or service.
Two parameters are essential in a SA, Polarity and Subjectivity.
Polarity, is the emotion in a sentence
Subjectivity, is the personanl feelings, visions in that sentence
The computer don't know the meaning of words in a sentence, that's why we use NLP, and after a Tokenization, we have POS (part of speech) terms
Now, in this small example, we go analise the sentiment of a hashtag.
For this SA, we use TextBlob module.
from textblob import TextBlob as tb
import tweepy
import numpy as np
consumer_key = 'your consumer key'
consumer_secret = 'your consumer secret'
access_token = 'your access token'
access_token_secret = 'your acess token secret'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
public_tweets = api.search('Github')
analysis = None
for tweet in public_tweets:
print(tweet.text)
analysis = tb(tweet.text)
print(analysis.sentiment.polarity)
Created a blob with the text from tweet, and after analysis we have a average with the range of [-1.0, 1.0]
Where values under zero, are negative feelings, and above zero, positive feelings
newtonjgaliza@gmail.com
@newtongaliza
AS é uma análise contextual que busca identificar e extrair informação subjetiva do material fonte, com o objetivo de ajudar um negócio, marca ou serviço a entender o sentimento social atrelado a ele. Geralmente realizando monitaramento em redes sociais.
Dois parâmetros são primordiais numa AS, Polaridade e Subjetividade.
Polaridade, é a emoção expressa em uma sentença.
Subjetividade, é a expressão de sentimentos pessoais, visão ou crença.
O computador não sabe o significado das palavras presentes numa sentença, para isso usamos NLP, que vai passar por uma Tokenization, para entao termos um POS(part of speech).
Vamos agora para um pequeno exemplo, onde iremos analisar os sentimentos de uma determinada hashtag.
Iremos utilizar o módulo TextBlob.
from textblob import TextBlob as tb
import tweepy
import numpy as np
consumer_key = 'your consumer key'
consumer_secret = 'your consumer secret'
access_token = 'your access token'
access_token_secret = 'your acess token secret'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
public_tweets = api.search('Github')
analysis = None
for tweet in public_tweets:
print(tweet.text)
analysis = tb(tweet.text)
print(analysis.sentiment.polarity)
Criamos um blob com o texto do tweet, e após análise temos um resultado com uma média de range [-1.0, 1.0]
Onde valores abaixo de zero, são sentimentos negativos e acima de zero, análises satisfatórias
newtonjgaliza@gmail.com
@newtongaliza