Tom*_*Tom 4 translation r google-translate
当寻找翻译其中文本的解决方案时R,我得到了很多相当旧的答案,建议使用该包translateR。我找到的最好的答案就是这个。
答案已经有 6 年历史了,同时translateR不再是 CRAN 存储库的一部分(有人知道为什么吗?)。我想知道现在是否有更好的选择,使用 CRAN 存储库中的包。
我的示例数据如下;
translate <- data.frame(sentences = c("This needs to be translated to Dutch",
"This also needs to be translated to Dutch",
"Just as this one has to"))
Run Code Online (Sandbox Code Playgroud)
当前在 R 中翻译文本的最佳选项是什么?
您可以使用deeplr使用deepl的API的包。Deepl 据说比谷歌翻译准确得多。
library(deeplr)
translate2(text = translate$sentences,
source_lang = "EN",
target_lang = "NL",
auth_key = "your_key")
#[1] "Dit moet vertaald worden naar het Nederlands"
#[2] "Dit moet ook vertaald worden naar het Nederlands"
#[3] "Net als deze moet"
Run Code Online (Sandbox Code Playgroud)