azure microsoft翻译插件java问题 [英] azure microsoft translate addon java problem
问题描述
大家好。我在我的azure帐户中添加了一个Microsoft Translation插件,我尝试使用下面的java示例。
$
ODataConsumer c = ODataConsumers
< span style ="white-space:pre"> .newBuilder(" https://api.datamarket.azure.com/Data.ashx/Bing/MicrosoftTranslator/v1/")
.setClientBehaviors(OClientBehaviors.basicAuth(" accountKey"," Insert Account Key")))
.build();
$
OQueryRequest< OEntity> oRequest = c.getEntities(" Translate")
.custom(" Text","'hello'" )
.custom(" To","'nl'");
枚举< OEntity> entities = oRequest.execute();
$
$
我下载并放入我的类路径中所需的jar我写了一个简单的小应用程序来从mongodb中获取一些文本并进行翻译。代码构建正常,但我得到以下错误:"线程中的异常"主要" java.lang.IllegalArgumentException:
根类型必须具有键"我打电话之后:有人可以帮忙吗?
$
OQueryRequest< OEntity> oRequest = c.getEntities(" Translate")
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; .custom(" Text","'blah'")
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; .custom(" To",'en'");
Hi all. I added a the Microsoft Translation addon to my azure account and I tried to use the java example below.
ODataConsumer c = ODataConsumers
.newBuilder("https://api.datamarket.azure.com/Data.ashx/Bing/MicrosoftTranslator/v1/")
.setClientBehaviors(OClientBehaviors.basicAuth("accountKey", "Insert Account Key"))
.build();
OQueryRequest<OEntity> oRequest = c.getEntities("Translate")
.custom("Text", "'hello'")
.custom("To", "'nl'");
Enumerable<OEntity> entities = oRequest.execute();
I downloaded and put the jars required in my classpath and I wrote a simple little app to get some text out of mongodb and translate it. The code builds fine, but i get the following error: "Exception in thread "main" java.lang.IllegalArgumentException:
Root types must have keys" just after I call: Can anyone help?
OQueryRequest<OEntity> oRequest = c.getEntities("Translate")
.custom("Text", "'blah'")
.custom("To", "'en'");
推荐答案
嗨鲍勃,
这里有一个API的Java包装器:
there is a Java wrapper for the API here:
https://github.com/boatmeme/microsoft-translator-java-api
我自己没试过。请告诉我们是否满足您的需求。
I have not tried it myself. Please let us know if it satisfies your needs.
Chris Wendt
Microsoft Translator
Chris Wendt
Microsoft Translator
这篇关于azure microsoft翻译插件java问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!