ProjectYulab
ProjectYulab copied to clipboard
在线翻译
写了一个翻译功能,用了百度翻译。在R包中可以直接用翻译,在某些场景之下,还是蛮方便的。
翻译源有很多,感兴趣的小伙伴,可以读一读api文档,写一下相应的翻译功能。
支持 | 翻译源 | 服务器地址 | 支持语种 | 方式 |
---|---|---|---|---|
✔ | 百度翻译 | https://fanyi-api.baidu.com/?fr=pcHeader | 中文、英语、日语、韩语、法语、俄语、德语 | 互译 |
✔ | 有道翻译 | https://ai.youdao.com/?keyfrom=fanyi-new-nav#/ | 中文、英语、日语、韩语、法语、俄语 | 互译 |
× | 谷歌翻译 | https://translate.google.cn/translate_a/single | 中文、英语、日语、韩语、法语、俄语、德语 | 互译 |
✔ | 腾讯翻译君 | https://fanyi.qq.com/translateapi | 中文、英语、日语、韩语、法语、俄语、德语 | 互译 |
× | 金山爱词霸 | http://fy.iciba.com/ajax.php?a=fy | 中文、英语、日语、韩语、法语、德语 | 互译 |
× | 搜狗翻译 | http://fanyi.sogou.com/reventondc/translate | 中文、英语、日语、韩语、法语、俄语、德语 | 互译 |
when i run y <- dplyr::mutate(x2,Description=en2cn(Description)) An error message is displayed.
Error in mutate()
:
ℹ In argument: Description = en2cn(Description)
.
Caused by error in vapply()
:
! 值的长度必需为1,
但FUN(X[[2]])结果的长度却是0
Run rlang::last_trace()
to see where the error occurred.
✔ Bing translate supported, https://github.com/YuLab-SMU/fanyi/pull/1.
Maybe you forgot deepl and OpenAI, the latter one has good translation performance but requires so-called prompt engineering :)
~Edit: the next translation engine I wanna add is volcengine (火山引擎 which is the subsidiary cloud platform owned by 字节跳动).~ (Done, 2023-12-25)
volcengine supported.