I am using VADER & NLTK to find the polarity of a tweet, but I was looking for how to find Valence, Arousal & Dominance values individually. Also, I want to know does Polarity is same as Valence in Sentiment Analysis? You can even try to do that using any other Sentiment Analysis Libraries like TextBlob, spaCy, TensorFlow etc.
I've found this library. And in my code I've used this .csv file with words' VAD scores.
And applied this code for finding the email's dataset VAD scores:
def VAD (text, vad_scores):
i,j=0, 0
text_vad=np.zeros([3,])
for word in text.split(' '):
neg=1 # reverse polarity for this word
if word in vad_scores.index:
if 'no' in text.split(' ')[j-6:j] or 'not' in text.split(' ')[j-6:j] or 'n\'t' in str(text.split(' ')[j-3:j]):
neg=-1
text_vad=vad_scores.loc[word]*neg + text_vad
i+=1
j+=1
return text_vad.valence/i, text_vad.arousal/i, text_vad.dominance/i
corpus=np.array(email['text'])
vad_scores=pd.read_csv("vad-nrc.csv", index_col='Word')
vad_feat=[VAD(text, vad_scores) for text in corpus ]
email[['valence', 'arousal', 'dominance']]=vad_feat
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.