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)
If you use the library in a research project, please include the following citation for the RuSentiment data:
@inproceedings{rogers-etal-2018-rusentiment,
title = "{R}u{S}entiment: An Enriched Sentiment Analysis Dataset for Social Media in {R}ussian",
author = "Rogers, Anna and
Romanov, Alexey and
Rumshisky, Anna and
Volkova, Svitlana and
Gronas, Mikhail and
Gribov, Alex",
booktitle = "Proceedings of the 27th International Conference on Computational Linguistics",
month = aug,
year = "2018",
address = "Santa Fe, New Mexico, USA",
publisher = "Association for Computational Linguistics",
url = "https://www.aclweb.org/anthology/C18-1064",
pages = "755--763",
}
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.6.0.tar.gz
(7.4 kB
view details)
Built Distribution
File details
Details for the file dostoevsky-0.6.0.tar.gz
.
File metadata
- Download URL: dostoevsky-0.6.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d058cd94fdf0e3c0131b15eb1383f464631ab76121442f22ea737197b60ab0c3 |
|
MD5 | 2fe0ef39db44414a727f676d9dd1929d |
|
BLAKE2b-256 | b5a82c97c7eed751b7a98607cfbbeb591cbdf0cd4e93ae1d539a13ad41b169a0 |
File details
Details for the file dostoevsky-0.6.0-py2.py3-none-any.whl
.
File metadata
- Download URL: dostoevsky-0.6.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 172e46f2d482466dbd4d7ed42bb07a899293948998632adc5d03d5625f3ec4e8 |
|
MD5 | 733d4ae54f27a9bb8e93f815f508b963 |
|
BLAKE2b-256 | b0f1662caeb5e3e3aa65dfcb7ece0a07fdd2c9184cf4c63fbcd53a381196d603 |