模糊字符串与tm包中的字典匹配

时间:2016-04-30 20:01:14

标签: r dictionary tm fuzzy-search

我想知道是否可以使用tm在R中的dictionary包中进行模糊字符串匹配。

例如,我有一个corpus,其中包含10个带有动物名称的文本文件。

我想使用corpus中提到的名称搜索dictionary,但也希望包含略有不同的动物名称。

要做完全匹配,我会写:

dictionary <- c("cat", "cats and dogs", "dog")
found_animals <- inspect(DocumentTermMatrix(docs, list(dictionary = dictionary))) 

如何进行模糊匹配,found_animals还包括“猫”,“狗”和其他近似词。这可能吗?

0 个答案:

没有答案