[PYTHON] Text sentiment analysis with ML-Ask

Ciao …… †

This time, I would like to introduce Sentiment Analysis Library ML-Ask.

What ML-Ask can do

Emotional estimation

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

Emotional strength is estimated by the number of interjections, onomatopoeia, sloppy words, emoticons, and "!" And "?".

Negative / positive classification

Sentences are classified into three types, {negative, positive, and neutral}, based on the estimated emotions.

Contextual considerations

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".

Whether it is active

Classify whether the sentence is {ACTIVE, NEUTRAL, PASSIVE} based on the estimated emotion. For example, "昂" is ACTIVE and "sorrow" is PASSIVE.

Python implementation of ML-Ask

It supports both Python 2 and 3 series.

Development repository

https://github.com/ikegami-yukino/pymlask Contributions are welcome!

Installation

pip install pymlask

How to use


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

Text sentiment analysis with ML-Ask
Sentiment analysis with Python (word2vec)
Text mining with Python ① Morphological analysis
Sentiment analysis of tweets with deep learning
Data analysis with python 2
Basket analysis with Spark (1)
Dependency analysis with CaboCha
Voice analysis with python
Text mining with Python-Scraping-
Pythonbrew with Sublime Text
Voice analysis with python
Regression analysis with NumPy
Data analysis with Python
Text mining with Python ① Morphological analysis (re: Linux version)
I tried Amazon Comprehend sentiment analysis with AWS CLI.
Challenge principal component analysis of text data with Python
[Python] Morphological analysis with MeCab
[Co-occurrence analysis] Easy co-occurrence analysis with Python! [Python]
Python: Japanese text: Morphological analysis
Multiple regression analysis with Keras
Thorough capture PDF open data. PDF text analysis starting with PDFMiner.
Texture analysis learned with pyradiomics
Sentiment analysis with natural language processing! I tried to predict the evaluation from the review text
Planar skeleton analysis with Python
Japanese morphological analysis with Python
Muscle jerk analysis with Python
[PowerShell] Morphological analysis with SudachiPy
Play with A3RT (Text Suggest)
Quantify "Don't use too strong words" (Sentiment analysis starting with BLEACH)
3D skeleton structure analysis with Python
GOTO in Python with Sublime Text 3
Impedance analysis (EIS) with python [impedance.py]
Text extraction with AWS Textract (Python3.6)
Negative / Positive Analysis 1 Application of Text Analysis
Enable Python raw_input with Sublime Text 3
Principal component analysis with Spark ML
Python: Negative / Positive Analysis: Text Analysis Application
Convenient analysis with Pandas + Jupyter notebook
Speak Japanese text with OpenJTalk + python
I played with Mecab (morphological analysis)!
Data analysis starting with python (data visualization 1)
Logistic regression analysis Self-made with python