在R中使用停用词“ tr”时分析土耳其文字的问题

时间:2018-09-06 08:07:30

标签: r text-mining

我正在分析R中的土耳其语文本。但是使用停用词“ tr”时出现问题 尽管在指示的链接中土耳其语用“ tr”表示,但仍无法识别。

这是错误:

错误:源“ snowball”中不提供语言“ tr”。有关受支持的语言的更多信息,请参见stopwords_getlanguages

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

您快到了。您只需要更改source从中获取语言的位置的stopwords::stopwords

tldr:

要运行代码,您需要:

stopwords::stopwords("tr", source = "stopwords-iso")
[1] "acaba"      "acep"       "adamakıllı" "adeta"      "ait"        "altmýþ"  ... 

说明:

这些是默认来源=“雪球”中可用的语言

stopwords::stopwords_getlanguages(source = "snowball")
[1] "da" "de" "en" "es" "fi" "fr" "hu" "ir" "it" "nl" "no" "pt" "ro" "ru" "sv"

要获取土耳其语,您只需将来源更改为source = "stopwords-iso"。您可以在下面看到此源中所有可用的停用词。

stopwords::stopwords_getlanguages(source = "stopwords-iso")
 [1] "af" "ar" "hy" "eu" "bn" "br" "bg" "ca" "zh" "hr" "cs" "da" "nl" "en" "eo" "et" "fi" "fr" "gl" "de" "el" "ha" "he" "hi" "hu" "id" "ga"
[28] "it" "ja" "ko" "ku" "la" "lt" "lv" "ms" "mr" "no" "fa" "pl" "pt" "ro" "ru" "sk" "sl" "so" "st" "es" "sw" "sv" "th" "tl" "tr" "uk" "ur"
[55] "vi" "yo" "zu"

这意味着要运行代码,您需要:

stopwords::stopwords("tr", source = "stopwords-iso")
[1] "acaba"      "acep"       "adamakıllı" "adeta"      "ait"        "altmýþ"  ...