Ciao …… †
This time, I would like to introduce Sentiment Analysis Library ML-Ask.
By pattern matching with a 2,100-word dictionary, we estimate 10 types of emotions: {joy, anger, sadness, fear, shame, good, 厭, 昂, cheap, surprise}. These 2,100 words are said to be based on the Emotional Expression Dictionary.
Emotional strength is estimated by the number of interjections, onomatopoeia, sloppy words, emoticons, and "!" And "?".
Sentences are classified into three types, {negative, positive, and neutral}, based on the estimated emotions.
Based on the concept of Contextual Valence Shifters (CVS), we perform emotion estimation considering the context. For example, in the case of the sentence "I don't like it", "like" is denied, so "like" I presume that it is the opposite feeling, "I'm sorry".
Classify whether the sentence is {ACTIVE, NEUTRAL, PASSIVE} based on the estimated emotion. For example, "昂" is ACTIVE and "sorrow" is PASSIVE.
It supports both Python 2 and 3 series.
https://github.com/ikegami-yukino/pymlask Contributions are welcome!
pip install pymlask
from mlask import MLAsk
emotion_analyzer = MLAsk()
emotion_analyzer.analyze('I don't hate him!(;´Д`)')
# => {'text': 'I don't hate him!(;´Д`)',
# 'emotion': defaultdict(<class 'list'>,{'yorokobi': ['Hate*CVS'], 'suki': ['Hate*CVS'], 'iya': ['Dislike']}),
# 'orientation': 'mostly_POSITIVE',
# 'activation': 'ACTIVE',
# 'emoticon': ['(;´Д`)'],
# 'intension': 2,
# 'intensifier': {'exclamation': ['!'], 'emotikony': ['(;´Д`)']},
# 'representative': ('yorokobi', ['Hate*CVS'])
# }
Recommended Posts