Learn R Programming

RYoudaoTranslate (version 1.0)

youdaoTranslate: Get result from youdao

Description

This function return a result from youdao translation using url privided by youdaoUrl function.

Usage

youdaoTranslate(word, api, keyfrom)

Arguments

word
The word you want to look up.
api
A Youdao API key. You can get it from http://fanyi.youdao.com/openapi.
keyfrom
A Youdao keyfrom. You can get it from http://fanyi.youdao.com/openapi.

Value

A list will be returned.

Details

All of three arguments are needed. This function will call youdaoUrl using getURL from RCurl package. The result is processed by fromJSON from rjson package.

References

http://fanyi.youdao.com/openapi?path=data-mode http://www.youdao.com/help/fanyiapi/privacy/

Examples

Run this code
	library(RCurl)
	library(rjson)
	apikey = "498375134"
	keyfrom = "JustForTestYouDao"
	word = "youdao"
	Obj = youdaoTranslate(word,api=apikey,keyfrom=keyfrom)

Run the code above in your browser using DataLab