YuLab-SMU / ProjectYulab

:next_track_button: Small coding tasks that enable you to participate in our development
33 stars 3 forks source link

在线翻译 #21

Open GuangchuangYu opened 11 months ago

GuangchuangYu commented 11 months ago

867af042ae77b69314b0e2d1af70cd1

写了一个翻译功能,用了百度翻译。在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 中文、英语、日语、韩语、法语、俄语、德语 互译
Fengyonghao commented 11 months ago

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.

GuangchuangYu commented 10 months ago

✔ Bing translate supported, https://github.com/YuLab-SMU/fanyi/pull/1.

MitsuhaMiyamizu commented 10 months ago

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)

GuangchuangYu commented 10 months ago

volcengine supported.

MitsuhaMiyamizu commented 10 months ago

腾讯翻译君 is supported, see https://github.com/YuLab-SMU/fanyi/pull/17 ~Next platform I wanna support is ChatGLM, this is the LLMaaS (Large Language Model as a Service, in Chinese: 大型语言模型即服务) by 智谱AI开放平台.~ (Done: 2024-01-07 at https://github.com/YuLab-SMU/fanyi/pull/18)