ecce offers some functions which translate English words into Chinese,
or translate Chinese words into English. Learn more in
vignette("ecce")
or help(package = "ecce")
. You can visit
https://cxy.rbind.io/ecce/ for the latest information.
# Install development version from GitLab
remotes::install_gitlab("chuxinyuan/ecce")
# Install from CRAN
install.packages("ecce")
To use the ecce package, users need to first register with the Youdao Wisdom Cloud AI open platform, and then open the text translation application. Then put your Youdao API ID and PASSWORD in the following code and run it once.
if (!file.exists("~/.Renviron")){
file.create("~/.Renviron")
}
file_path = "~/.Renviron"
file = file(file_path, open = "a")
comment = "# ID and PASSWORD of Youdao Translation"
writeLines(comment, file)
code_lines = c(
"app_key = \"Your Youdao API ID\"",
"app_secret = \"Your Youdao API PASSWORD\""
)
for (code in code_lines) {
writeLines(code, file)
}
close(file)
Get started with pass a Chinese or English word into the translation function. In addition, also support obtain the pinyin of the Chinese character, so that you can more easily understand the pronunciation of the Chinese character.
# Example-1
translate("中国")
# Example-2
translate("good")
# Example-3
translate_view("中国")
# Example-4
translate_view("good")
# Example-5
pinyin("模型")
ecce is free and open source software, licensed under MIT + file LICENSE.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.