title: Sentiment analysis in R for cyrillic
body: <p>I can't comment on this page where i found a function <a href="https://stackoverflow.com/questions/47339479/sentiment-analysis-text-analytics-in-russian-cyrillic-languages/48642615#48642615">Sentiment Analysis Text Analytics in Russian / Cyrillic languages</a></p>
  
  <pre><code>get_sentiment_rus &lt;- function(char_v, method="custom", lexicon=NULL, path_to_tagger = NULL, cl = NULL, language = "english") {
    language &lt;- tolower(language)
    russ.char.yes &lt;- "[\u0401\u0410-\u044F\u0451]"
    russ.char.no &lt;- "[^\u0401\u0410-\u044F\u0451]"
  
      if (is.na(pmatch(method, c("syuzhet", "afinn", "bing", "nrc", 
                               "stanford", "custom")))) 
      stop("Invalid Method")
    if (!is.character(char_v)) 
      stop("Data must be a character vector.")
    if (!is.null(cl) &amp;&amp; !inherits(cl, "cluster")) 
      stop("Invalid Cluster")
    if (method == "syuzhet") {
      char_v &lt;- gsub("-", "", char_v)
    }
    if (method == "afinn" || method == "bing" || method == "syuzhet") {
      word_l &lt;- strsplit(tolower(char_v), "[^A-Za-z']+")
      if (is.null(cl)) {
        result &lt;- unlist(lapply(word_l, get_sent_values, 
                                method))
      }
      else {
        result &lt;- unlist(parallel::parLapply(cl = cl, word_l, 
                                             get_sent_values, method))
      }
    }
    else if (method == "nrc") {
  #    word_l &lt;- strsplit(tolower(char_v), "[^A-Za-z']+")
      word_l &lt;- strsplit(tolower(char_v), paste0(russ.char.no, "+"), perl=T)
      lexicon &lt;- dplyr::filter_(syuzhet:::nrc, ~lang == tolower(language), 
                                ~sentiment %in% c("positive", "negative"))
      lexicon[which(lexicon$sentiment == "negative"), "value"] &lt;- -1
      result &lt;- unlist(lapply(word_l, get_sent_values, method, 
                              lexicon))
    }
    else if (method == "custom") {
  #    word_l &lt;- strsplit(tolower(char_v), "[^A-Za-z']+")
      word_l &lt;- strsplit(tolower(char_v), paste0(russ.char.no, "+"), perl=T)
      result &lt;- unlist(lapply(word_l, get_sent_values, method, 
                              lexicon))
    }
    else if (method == "stanford") {
      if (is.null(path_to_tagger)) 
        stop("You must include a path to your installation of the coreNLP package.  See http://nlp.stanford.edu/software/corenlp.shtml")
      result &lt;- get_stanford_sentiment(char_v, path_to_tagger)
    }
    return(result)
  }
  </code></pre>
  
  <p>It gives an error</p>
  
  <pre><code>&gt; mysentiment &lt;- get_sentiment_rus(as.character(corpus))
   Show Traceback
  
   Rerun with Debug
   Error in UseMethod("filter_") : 
    no applicable method for 'filter_' applied to an object of class "NULL" 
  </code></pre>
  
  <p>And the sentiment scores are equal to 0</p>
  
  <pre><code>&gt; SentimentScores &lt;- data.frame(colSums(mysentiment[,]))
  &gt; SentimentScores
               colSums.mysentiment.....
  anger                               0
  anticipation                        0
  disgust                             0
  fear                                0
  joy                                 0
  sadness                             0
  surprise                            0
  trust                               0
  negative                            0
  positive                            0
  </code></pre>
  
  <p>Could you please point out where a problem might be? Or suggest any other working method for sentiment analysis в R? Just wonder what package supports russian language.</p>
  
  <p>I am looking for any working method for sentiment analysis of a text in russian.</p>