I want to translate a group of words into simplified Chinese more quickly:
wordlist1 =
ToString /@ {abate, aberrant, abound, abrogate, abstain, abstruse,
accede, accessory, accommodate, accredit, acquaint, acquisitive,
adduce, adept, admonish, adore, adorn, affiliate, affluent,
agitate, agony, agreeable, album, allegiance, allegorical};
WordTranslation[#, "Chinese"] & /@ wordlist1
But the result of the above code is traditional Chinese. If I specify "SimplifiedChinese" as the parameter, I still can't get the desired result. How can I get the result of simplified Chinese?
{\[LongDash],\[LongDash],\[LongDash],\[LongDash],{戒},\[LongDash],\[LongDash],{附件},{提供住宿},\[LongDash],{使認識},\[LongDash],\[LongDash],\[LongDash],\[LongDash],{崇拜},{裝飾},\[LongDash],{豐富的},{煽動},{極度痛苦},{同意的},{簿},{忠誠},\[LongDash]}
BaiduTranslate[str_, from_ : "en", to_ : "zh"] :=
Block[{q, appid, key, salt, sign, data},
q = str;
appid = "20190314000277077";(*你的appid,如何申请请自行百度*)
key = "sjRd6QGeuLAR1jTr0d3G";
salt = ToString@RandomInteger[2^32];
sign = Hash[StringJoin[appid, q, salt, key], "MD5", "HexString"];
data = Import[
StringJoin[
"http://api.fanyi.baidu.com/api/trans/vip/translate?q=",
URLEncode@q, "&from=", from, "&to=", to, "&appid=", appid,
"&salt=", salt, "&sign=", sign], "RawJSON"];
data["trans_result"][[1]]["dst"]]
BaiduTranslate /@ wordlist1
If I use the above code, I will get a lot of word results as "KeyAbsent"("dst")
, how can I modify it to better translate this group of words?