Microsoft认知文本翻译工作不准确

时间:2017-04-25 19:59:19

标签: azure microsoft-cognitive

我使用的是microsoft azure的翻译api,它的工作原理不准确。 在我的例子中,我将英语翻译成德语:

enter image description here

enter image description here

第一张图片显示正确的翻译,除了" apple"这应该是#34; Apfel"在德国,第二张图片显示了另一个错误,因为" pepino"是德语a" Birnenmelone",dict.leo.org也知道这一点。 有没有人知道如何提高服务的准确性或如何更改输入以获得更好的输出?

更新:我认为还有上下文计数,所以我只是简单地使用文章,并尝试甚至给出" XYZ的上下文是一个水果"。这使得结果略好一些,因此现在大约有50%的反馈。

1 个答案:

答案 0 :(得分:0)

Translator API不是字典查找,而是自然语言的翻译,其中上下文可以帮助确定翻译。如果您只是在搜索单个单词,那么Translation API通常会在训练数据中返回该单词最常用的形式,对于" apple"将是苹果公司。

或者,您可以调用GetTranslations API(或GetTranslationsArray),并使用<options>传递可选的<IncludeMultipleMTAlternatives>true</IncludeMultipleMTAlternatives>正文,而不是调用Translate API,以获得多个替代翻译。这在https://msdn.microsoft.com/en-us/library/dn887253.aspx中有记录,我们正在努力将其纳入Azure Cognitive Services文档。

示例:

请求

POST https://api.microsofttranslator.com/v2/Http.svc/GetTranslations?text=apple&from=en&to=de&maxTranslations=5 HTTP/1.1
User-Agent: Fiddler 
Authorization: Bearer xxx
Host: api.microsofttranslator.com
Content-Length: 325
Expect: 100-continue
Content-Type: text/xml

<TranslateOptions xmlns="http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2"><Category>general</Category><ContentType>text/plain</ContentType><IncludeMultipleMTAlternatives>true</IncludeMultipleMTAlternatives><ReservedFlags></ReservedFlags><State></State><Uri></Uri><User>TestUserId</User></TranslateOptions>

<强> RESPONSE

HTTP/1.1 200 OK Content-Length: 553 Content-Type: application/xml; charset=utf-8 X-MS-Trans-Info: 0639.V2_Rest.GetTranslations.491248A8 Date: Fri, 28 Apr 2017 20:55:44 GMT

<GetTranslationsResponse xmlns="http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><From>en</From><State/><Translations><TranslationMatch><Count>0</Count><MatchDegree>100</MatchDegree><MatchedOriginalText/><Rating>5</Rating><TranslatedText>Apple</TranslatedText></TranslationMatch><TranslationMatch><Count>0</Count><MatchDegree>100</MatchDegree><MatchedOriginalText/><Rating>0</Rating><TranslatedText>Apfel</TranslatedText></TranslationMatch></Translations></GetTranslationsResponse>