ikegami-yukino / oseti

Dictionary based Sentiment Analysis for Japanese
MIT License
91 stars 15 forks source link
japanese-language nlp sentiment-analysis sentiment-polarity

oseti

|circleci| |coveralls| |pyversion| |version| |license|

Dictionary based Sentiment Analysis for Japanese

INSTALLATION

::

$ pip install oseti

USAGE

.. code:: python

import oseti

analyzer = oseti.Analyzer() analyzer.analyze('天国で待ってる。')

=> [1.0]

analyzer.analyze('遅刻したけど楽しかったし嬉しかった。すごく充実した!')

=> [0.3333333333333333, 1.0]

analyzer.count_polarity('遅刻したけど楽しかったし嬉しかった。すごく充実した!')

=> [{'positive': 2, 'negative': 1}, {'positive': 1, 'negative': 0}])

analyzer.count_polarity('そこにはいつもと変わらない日常があった。')

=> [{'positive': 0, 'negative': 0}]

analyzer.analyze_detail('お金も希望もない!')

=> [{'positive': [], 'negative': ['お金-NEGATION', '希望-NEGATION'], 'score': -1.0}])

analyzer.analyze_detail('お金がないわけではない')

=> [{'positive': ['お金'], 'negative': [], 'score': 1.0}]

Applying user's dictionary

analyzer = oseti.Analyzer(word_dict={'カワイイ': 'p', 'ブサイク': 'n'}, wago_dict={'イカ する': 'ポジ', 'まがまがしい': 'ネガ'}) analyzer.analyze_detail("カワイイ")

=> [{'positive': ['カワイイ'], 'negative': [], 'score': 1.0}]

analyzer.analyze_detail("ブサイクだ")

=> [{'positive': [], 'negative': ['ブサイク'], 'score': -1.0}]

analyzer.analyze_detail("まがまがしい")

=> [{'positive': [], 'negative': ['まがまがしい'], 'score': -1.0}]

analyzer.analyze_detail("イカすよ")

=> [{'positive': ['イカ する'], 'negative': [], 'score': 1.0}]

ACKNOWLEDGEMENT

This module uses 日本語評価極性辞書(用言編)ver.1.0 and 日本語評価極性辞書(名詞編)ver.1.0

Cited by

Scientific paper

Slide

Blog

.. |circleci| image:: https://dl.circleci.com/status-badge/img/gh/ikegami-yukino/oseti/tree/master.svg?style=svg :target: https://dl.circleci.com/status-badge/redirect/gh/ikegami-yukino/oseti/tree/master

.. |coveralls| image:: https://coveralls.io/repos/ikegami-yukino/oseti/badge.svg?branch=master&service=github :target: https://coveralls.io/github/ikegami-yukino/oseti?branch=master :alt: coveralls.io

.. |pyversion| image:: https://img.shields.io/pypi/pyversions/oseti.svg

.. |version| image:: https://img.shields.io/pypi/v/oseti.svg :target: http://pypi.python.org/pypi/oseti/ :alt: latest version

.. |license| image:: https://img.shields.io/pypi/l/oseti.svg :target: http://pypi.python.org/pypi/oseti/ :alt: license