Skip to content

Sentiment analysis library for russian language

License

Notifications You must be signed in to change notification settings

29user/dostoevsky

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dostoevsky Build Status FOSSA Status

Sentiment analysis library for russian language

Install

Please note that Dostoevsky supports only Python 3.6 (3.7+ version'll be supported when tensorflow get it support, sorry)

$ pip install dostoevsky

Social networks comment model

This model was trained on RuSentiment dataset and achieves up to ~0.70 F1 score

Usage

First of all, you'll need to download pretrained word embeddings and model:

$ dostoevsky download vk-embeddings cnn-social-network-model

Then, we can build our pipeline: text -> tokenizer -> word embeddings -> CNN

from dostoevsky.tokenization import UDBaselineTokenizer
from dostoevsky.word_vectors import SocialNetworkWordVectores
from dostoevsky.models import SocialNetworkModel

tokenizer = UDBaselineTokenizer()
tokens = tokenizer.split('всё очень плохо')  # [('всё', 'ADJ'), ('очень', 'ADV'), ('плохо', 'ADV')]

word_vectors_container = SocialNetworkWordVectores()

vectors = word_vectors_container.get_word_vectors(tokens)
vectors.shape  # (3, 300) - three words/vectors with dim=300

model = SocialNetworkModel(
  tokenizer=tokenizer,
  word_vectors_container=word_vectors_container,
  lemmatize=False,
)

model.predict(['наступили на ногу', 'всё суперски'])  # array(['negative', 'positive'], dtype='<U8')

License

FOSSA Status

About

Sentiment analysis library for russian language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%