Skip to main content

Sentiment analysis library for russian language

Project description

Dostoevsky Build Status FOSSA Status

Sentiment analysis library for russian language


Please note that Dostoevsky supports only Python 3.6+

$ pip install dostoevsky

Social network model [FastText]

This model was trained on RuSentiment dataset and achieves up to ~0.71 F1 score.
Hyperparameters used for training:

epoch = 10
lr = 0.21909
dim = 64
minCount = 1
wordNgrams = 3
minn = 2
maxn = 5
bucket = 259929
dsub = 2
loss = one-vs-all


First of all, you'll need to download binary model:

$ 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dostoevsky, version 0.4.0
Filename, size File type Python version Upload date Hashes
Filename, size dostoevsky-0.4.0-py3-none-any.whl (10.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size dostoevsky-0.4.0.tar.gz (7.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page