vy32
vy32

Reputation: 29667

Extract "emotion words" / affect words from english corpus?

I have lots of English language text and am looking for a way to extract the words that have emotional content, such as "anger," "hate," "paranoid," "exited," and so on. Is there a way to do this with NLTK or WordNet?

Upvotes: 1

Views: 1784

Answers (1)

Riyaz
Riyaz

Reputation: 1470

You can use SentiWordNet Interface in NLTK to check for the emotional content of an English word. Usage from NLTK.

>>> from nltk.corpus import sentiwordnet as swn

>>> list(swn.senti_synsets('breakdown'))
[SentiSynset('dislocation.n.02'),
 SentiSynset('breakdown.n.02'),
 SentiSynset('breakdown.n.03'),
 SentiSynset('breakdown.n.04')]

>>> breakdown = swn.senti_synset('breakdown.n.03')
>>> print(breakdown)
<breakdown.n.03: PosScore=0.0 NegScore=0.25>
>>> breakdown.pos_score()
0.0
>>> breakdown.neg_score()
0.25
>>> breakdown.obj_score()
0.75

Upvotes: 2

Related Questions