2017-11-16 9 views
0

これは信じられないほどのリソースです。プラットフォームへの貢献度がどれくらいあるかは信じられない。 ロシア語/キリル言語を使用したテキスト分析/感情分析を扱う際のアドバイスに感謝します。感情分析テキスト解析(ロシア語/キリル言語)

Syuzhetが私の好みのツールです - 8つの感情と負と正の極性にまたがる感情を得る機会が優れています。しかし、私はそれがキリル語をサポートしているとは思わない。

代替手段はありますか?

答えて

0

私はちょうど同じことを理解しようとしていました。キリル文字コーパスでいくつかの感情分析を実行する方法です。優れたsyuzhetパッケージがまだキリル文字をサポートしていないのは間違いありませんが、私はjerry-rigにsyuzhetの修正バージョンを提供することができました!ここに私が使ったコードがあります。 nrcメソッドとロシア語を指定することもできますし、カスタムメソッドを使用して独自のロシア語辞書を用意することもできます。

希望します。あなたのマイレージは異なる場合があります!

get_sentiment_rus <- function(char_v, method="custom", lexicon=NULL, path_to_tagger = NULL, cl = NULL, language = "english") { 
    language <- tolower(language) 
    russ.char.yes <- "[\u0401\u0410-\u044F\u0451]" 
    russ.char.no <- "[^\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) && !inherits(cl, "cluster")) 
    stop("Invalid Cluster") 
    if (method == "syuzhet") { 
    char_v <- gsub("-", "", char_v) 
    } 
    if (method == "afinn" || method == "bing" || method == "syuzhet") { 
    word_l <- strsplit(tolower(char_v), "[^A-Za-z']+") 
    if (is.null(cl)) { 
     result <- unlist(lapply(word_l, get_sent_values, 
           method)) 
    } 
    else { 
     result <- unlist(parallel::parLapply(cl = cl, word_l, 
              get_sent_values, method)) 
    } 
    } 
    else if (method == "nrc") { 
# word_l <- strsplit(tolower(char_v), "[^A-Za-z']+") 
    word_l <- strsplit(tolower(char_v), paste0(russ.char.no, "+"), perl=T) 
    lexicon <- dplyr::filter_(syuzhet:::nrc, ~lang == tolower(language), 
           ~sentiment %in% c("positive", "negative")) 
    lexicon[which(lexicon$sentiment == "negative"), "value"] <- -1 
    result <- unlist(lapply(word_l, get_sent_values, method, 
          lexicon)) 
    } 
    else if (method == "custom") { 
# word_l <- strsplit(tolower(char_v), "[^A-Za-z']+") 
    word_l <- strsplit(tolower(char_v), paste0(russ.char.no, "+"), perl=T) 
    result <- 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 <- get_stanford_sentiment(char_v, path_to_tagger) 
    } 
    return(result) 
} 
+0

こんにちはノア、ありがとう、私は本当にあなたのコードを共有していただきありがとうございます!質問を投稿してから、私はここでいくつかの進歩を遂げました。あなたがとても親切で分かち合っていたので、私は満足しています。おそらく私たちは電子メールでベースに触れることができました - 私はrobert [dot] chestnutt2 [at] mail [dot] dcu [dot]にいるか、Dublin City UniversityのSchool of Law&Governmentのウェブサイト –