The goal of ecce is to make it easy to translate English words into Chinese, or translate Chinese words into English. It support pipe functions %>%
to manipulate data.
# Install development version from GitLab
::install_git("https://gitlab.com/chuxinyuan/ecce.git") remotes
# Example-1
<- "苹果"
x1 translate(x1)
# Example-2
<- "apple"
x2 translate(x2)
# Example-3
<- c("苹果", "香蕉", "梨子", "我爱你")
x3 translate(x3)
# Example-4
<- c("apple", "banana", "pear", "I love you")
x4 translate(x4)
# Example-5
<- "苹果"
x5 translate_full(x5)
# Example-6
<- "apple"
x6 translate_full(x6)
This function translate_full()
also support pass into a vector which consists of Chinese or English words. But the form of output is not elegant enough.
# Example-7
<- "苹果"
x7 translate_view(x7)
# Example-8
<- "apple"
x8 translate_view(x8)
In the same way, this function also support pass into a vector.
library(dplyr)
<- c("father", "mother", "I love U")
love %>%
love translate() %>%
paste0(., collapse = "")
ecce package is based on RYoudaoTranslate(Ke-Hao Wu, 2014), which provides function to translate English words into Chinese. also provides interface to Youdao translation open API for R user. But this software is not very friendly to use, which can’t support translate Chinese words into English, I have made some improvements on the basis of this software.
Ke-Hao Wu (2014). RYoudaoTranslate: R package provide functions to translate English words into Chinese. R package version 1.0. https://CRAN.R-project.org/package=RYoudaoTranslate