R Interface to Yandex Translate API. Yandex Translate is a statistical machine translation system. The system translates separate words, complete texts, and webpages. This package can be used to detect language from text and to translate it to supported target language.

Installation

To install from CRAN repository:

install.packages("RYandexTranslate")

To install from github:

library(devtools)
install_github("mukul13/RYandexTranslate")

To get free API key, sign up here

api_key="YOUR API KEY"

Examples

To list all functions supported by RYandexTranslate package

library(RYandexTranslate)
ls("package:RYandexTranslate")
#>"detect_language"   "get_translation_direction"   "translate"   

To get a list of translation directions supported by the service

directions=get_translation_direction(api_key)
head(directions$dirs)
#>"az-ru" "be-bg" "be-cs" "be-de" "be-en" "be-es"

To detect the language of the specified text

data=detect_language(api_key,text="how are you?")
data
#>"en"

To translate text to the specified language

data=translate(api_key,text="how are you?",lang="en-hi")
data
#>$lang
#>[1] "en-hi"
#>
#>$text
#>[1] "आप कैसे हैं?"

Resources



mukul13/RYandexTranslate documentation built on Sept. 26, 2019, 2:21 p.m.