在 dfm 中如何检测非英语单词并将其删除?
\ndftest <- data.frame(id = 1:3, \n text = c("Holla this is a spanish word", \n "English online here", \n "Bonjour, comment \xc3\xa7a va?"))\nRun Code Online (Sandbox Code Playgroud)\ndfm 的构造示例如下:
\ntestDfm <- dftest$text %>%\n tokens(remove_punct = TRUE, remove_numbers = TRUE, remove_symbols = TRUE) %>% %>% tokens_wordstem() %>%\n dfm()\nRun Code Online (Sandbox Code Playgroud)\n我发现 textcat 包作为替代解决方案,但在真实数据集中有很多情况,其中整行都是英语,它仅将其识别为另一种语言的字符。是否有其他方法可以使用 quanteda 在 dfm 中的数据帧或标记中查找非英语行?
\n