Sentiment analysis library for russian language
Project description
Dostoevsky
Sentiment analysis library for russian language
Install
Please note that Dostoevsky
supports only Python 3.6+ on both Linux and Windows
$ pip install dostoevsky
Social network model [FastText]
This model was trained on RuSentiment dataset and achieves up to ~0.71 F1 score.
Usage
First of all, you'll need to download binary model:
$ python -m dostoevsky download fasttext-social-network-model
Then you can use sentiment analyzer:
from dostoevsky.tokenization import RegexTokenizer
from dostoevsky.models import FastTextSocialNetworkModel
tokenizer = RegexTokenizer()
tokens = tokenizer.split('всё очень плохо') # [('всё', None), ('очень', None), ('плохо', None)]
model = FastTextSocialNetworkModel(tokenizer=tokenizer)
messages = [
'привет',
'я люблю тебя!!',
'малолетние дебилы'
]
results = model.predict(messages, k=2)
for message, sentiment in zip(messages, results):
# привет -> {'speech': 1.0000100135803223, 'skip': 0.0020607432816177607}
# люблю тебя!! -> {'positive': 0.9886782765388489, 'skip': 0.005394937004894018}
# малолетние дебилы -> {'negative': 0.9525841474533081, 'neutral': 0.13661839067935944}]
print(message, '->', sentiment)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dostoevsky-0.5.0.tar.gz
(6.6 kB
view hashes)
Built Distribution
dostoevsky-0.5.0-py3-none-any.whl
(10.4 kB
view hashes)
Close
Hashes for dostoevsky-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffb6047c9208399160343f171e03061971eee2dfaa6a60f28ad3d698c211015d |
|
MD5 | 6bfb2945ec1b22a1a14c89f8abf600b7 |
|
BLAKE2b-256 | 086ab7c0fcfd59cc8ccf5f2924bb6156e18c5115578549abb1249425a4b19d74 |