r - RTextTools 中的德语词干分析器

标签 r unicode nlp non-english

我正在尝试使用 RTextTools 附带的德语词干分析器,但我得到的结果非常不合适。

说,我有以下向量:

v <- c("groß", "größer", "am", "größten", "ähnlicher")

使用
library(RTextTools)
wordStem(v, "german")

我得到
[1] "groß"    "größer"  "am"      "größten" "ähnlich"

我错过了什么??

最佳答案

Snowball 中的算法

/*
    Extra rule for -nisse ending added 11 Dec 2009
*/

routines (
           prelude postlude
           mark_regions
           R1 R2
           standard_suffix
)

externals ( stem )

integers ( p1 p2 x )

groupings ( v s_ending st_ending )

stringescapes {}

/* special characters (in ISO Latin I) */

stringdef a"   hex 'E4'
stringdef o"   hex 'F6'
stringdef u"   hex 'FC'
stringdef ss   hex 'DF'
......

看起来它被翻译回“DF”“ß”

通过以下 e 表示变音符号
德语字母 ä、ö 和 ü 偶尔分别用 ae、oe 和 ue 表示。考虑到这一点,这里的词干分析器是主要德国词干分析器的变体。

主要的德国词干分析器从规则开始,
First, replace ß by ss, and put u and y between vowels into upper case. 

这被规则取代,
Put u and y between vowels into upper case, and then do the following mappings,

    (a) replace ß with ss, **"MAYBE WRONG ORDER"**
    (a) replace ae with ä,
    (a) replace oe with ö,
    (a) replace ue with ü unless preceded by q. 



So in quelle, ue is not mapped to ü because it follows q, and in feuer it is not mapped because the first part of the rule changes it to feUer, so the u is not found. 

关于r - RTextTools 中的德语词干分析器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10955521/

相关文章:

python - 使用电子邮件数据 0.3.4 使用 Python 3.6 读取 .eml 文件

email - 如何提取没有签名或引用文本的电子邮件正文

r - 当某些列表元素不可用时,在 R 中创建列表

r - 根据背景颜色将颜色映射到ggplot中的标签

c++ - 如何在没有_setmode的情况下在C++中输出unicode

c - C 程序中的数据类型规范 ASCII、ISO-8859、UTF-8 Unicode

pdf - PDF 文件是否有一个字段指定其编码?

c - 用于简单 POS 标记的 NLP 库

r - 如何使用 ggplot2 将标准误差线添加到箱须图?

将制表符分隔的数据读入 R