【问题标题】:Some characters in stopwords_tr do not appear Turkish characterstopwords_tr 中的某些字符不会出现土耳其字符
【发布时间】:2019-07-12 14:02:40
【问题描述】:
stopwords_tr <- data.frame(word = stopwords::stopwords("tr",source="stopwords-iso"), stringsAsFactors = FALSE)
stopwords_tr

stopwords_tr 中的某些字符不是土耳其语。例如;

1   acaba
2   acep
3   adamakıllı
4   adeta
5   ait
6   altmýþ   <-Here must be: altmış
7   altmış
8   altý     <-Here must be: altı

我正在寻找修复它们的方法。

stopwords_tr$word<-gsub("ý","ı",stopwords_tr$word)

结果没有改变。 我试过这些,但没有。

Encoding (stopwords_tr $ word) <- "WINDOWS-1254"
Encoding (stopwords_tr $ word) <- "LATIN-5"
Encoding (stopwords_tr $ word) <- "UTF-8"

另一个有趣的事情。

当您在 R Studio 中双击 stopwords_tr 以显示它时,字符会出现 "ý"。在控制台中,它看起来像"y"

有设置编码的参数吗? 谢谢大家。

【问题讨论】:

    标签: r replace gsub stop-words


    【解决方案1】:

    如果您确定这是一个错误,我认为解决此问题的最佳方法是修复原始来源:将问题发布到 https://github.com/stopwords-iso/stopwords-iso/issueshttps://github.com/stopwords-iso/stopwords-tr/issues(不确定哪个更好;尝试一个,然后如果你弄错了,他们会告诉你的!)

    但请检查它是否真的是错误的。我不懂土耳其语,但是当我在 Google 上搜索“altmýþ”时,我会在几个对我来说看起来像土耳其语的页面上找到它,例如https://greatsong.net/PAROLES-ISMAIL-YK,ISTEMIYORUM-SENI,101646494.html。可能是一个编码错误,但如果它是一个常见的错误,也许你真的希望它出现在列表中。

    关于显示问题:听起来你在 Windows 上。 Windows 上的 R 在显示非本地字符时出现问题。你可能没有安装冰岛语,所以它会很难显示像 altmýþ 这样的词。

    【讨论】:

    • 您好,感谢您的回复。我正在通过键入以下代码来解决 R 的字符问题。 Sys.setlocale("LC_CTYPE", "土耳其语")。 R 的停用词的位置与您所说的不同。根据您的建议,我已将其添加到 github.com/quanteda/stopwords/issues/15。谢谢#user2554330。
    【解决方案2】:

    我听从了#user2554330 的建议。但是,我申请的地址与他显示的地址不同。 我联系了 stopwords-tr 的创建者(Kenneth Benoit)。问题源于错误编码的数据源。我还注意到重复的单词并报告了它们。我们一起解决了性格问题。停用词-tr 已更新。在以下地址;

    (修复土耳其语 #16)

    https://github.com/quanteda/stopwords/pull/16

    devtools::install_github("quanteda/stopwords", ref = "fix-tr")
    
    stopwords("tr", source = "stopwords-iso")
    

    “Turkish Stopwords”现在似乎已正确编码。 问候..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-13
      • 1970-01-01
      • 1970-01-01
      • 2016-10-09
      • 2014-07-25
      • 1970-01-01
      • 1970-01-01
      • 2015-01-07
      相关资源
      最近更新 更多