Does anybody knows python library to retrieve sentiment from Russian text. The dictionary with sentiment parameterization will be ok to. The idea of library something like in GPOMS in article.

  • Why should it be any different from, say, English? Python can transparently process UTF8. Do you foresee any specific problem with grammar or anything? – Diego Feb 13 '16 at 14:55
  • @Diego, as I understand, I need a dictionary of words of the Russian language with the weight of each word (something like this for English). Which library could you advise my? – MrFroll Feb 13 '16 at 19:51
  • May be you should replace the word library with the word dictionary in your question. Python library is usually referring to a bunch of functions and classes, not just a collection of words. – Diego Feb 14 '16 at 1:25
  • @Diego, thank you for recommendation, but I think my question correctly shows that I'm interested in dictionary or library. Both for me will be ok. – MrFroll Feb 15 '16 at 16:22
  • 1
    Possible duplicate of Sentiment Analysis model for Spanish – VividD May 10 '17 at 15:56
up vote 6 down vote accepted

If you are seeking a working solution, I know of an API that supports many languages, including Russian: indico.io Text Analysis sentiment()

>>> import indicoio
>>> indicoio.config.api_key = YOUR_API_KEY
>>> indicoio.sentiment(u"Это круто, убивает!  Хочу.", language='ru')
0.6978093435482927
>>> indicoio.sentiment(u"Ты кто такой?  Давай досвидания", language='ru')
0.13258737684773209

Note that the language parameter is optional

(Obviously it's not a lib, but they offer a Python client and their free tier is generous enough.)

Update: As of Q2 2018, Google and IBM sentiment analysis APIs still do not support Russian.

Take a look at the polyglot library. It has polarity lexicons for 136 languages, including Russian.

The scale of the words’ polarity consisted of three degrees: +1 for positive words, and -1 for negatives words. Neutral words will have a score of 0.

You can use it like this:

>>> from polyglot.text import Text as T
>>> text = T("это очень плохо. А это намного лучше, даже хорошо!")
>>> text.polarity
0.33333333333333331

>>> for s in text.sentences:
...  s, s.polarity
... 
(Sentence("это очень плохо."), -1.0)
(Sentence("А это намного лучше, даже хорошо!"), 1.0)

>>> for w in text.words:
...   print("{:<16}{:>2}".format(w, w.polarity))
... 
это              0
очень            0
плохо           -1
.                0
А                0
это              0
намного          0
лучше            1
,                0
даже             0
хорошо           1
!                0

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.