Microsoft Translator是否设计用于翻译整个网页? [英] Is Microsoft Translator designed to translate whole web pages?
问题描述
您好
我的应用需要在一天中的不同时间抓取,翻译和保存网页,以便在工作时间内以英文阅读。
My app needs to grab, translate and save web pages at different times of the day so that they can be read in English during working hours.
我使用SOAP API编写了一个简单的Translator App,它接受一个URL,将页面转换为字符串并将其传递给SOAP API。
I've written a simple Translator App using the SOAP API that takes a URL, streams the page into a string and passes it to the SOAP API.
它非常适用于非常简单的网页。对于较大的页面(20-100K),每次"错误请求"都会失败,即使相同的页面通过IE手动使用翻译器成功翻译。我需要处理的大多数页面都在50-200K大小的
范围内。
It works perfectly for very simple web pages. For larger pages (20-100K) it fails every time with 'Bad Request', even though the same pages translate successfully using Translator manually via IE. Most of the pages I need to process are in the 50-200K size range.
例如,该应用程序使用这个简单的URL:http:// www .lecanardenchaine.fr / trvlap.html
For example, the app works with this simple URL: http://www.lecanardenchaine.fr/trvlap.html
但是我尝试的每一个都失败了(例如:&absp; http://fr.wikipedia.org/wiki/Albert_Camus )
But fails with every other one I try (eg: http://fr.wikipedia.org/wiki/Albert_Camus)
上述两个页面均未通过W3C验证器测试,但两者都在所有浏览器中正确呈现,并且在其他HTML预处理器中。
Neither of the above pages pass W3C validator test, but both render correctly in all browsers, and in other HTML pre-processors.
我错误地认为翻译器可用于此类任务或我遗失了什么?
Am I wrong to assume that Translator can be used for such tasks or am I missing something?
我使用HTTP API编写相同的程序并获得相同的行为 - "错误请求"伴随着WebException状态为"ProtocolError"(7)。
I've written the same programme using the HTTP API and get the same behaviour - the 'Bad Request' is accompanied by a WebException status of 'ProtocolError' (7).
我使用的代码非常简单:
The code I'm using is very simple:
其中客户是TranslatorService的一个实例。
where client is an instance of TranslatorService.
任何帮助非常感谢 - 我需要决定是否可以继续使用翻译。
any help much appreciated - I need to decide whether I can continue using Translator.
祝福
Rob Macdonald
Rob Macdonald
推荐答案
Hello,Rob,
Hello, Rob,
当您尝试翻译具有大量内容的网页时,您会始终看到此问题。
You see this issue consistently when you tried to translate Web Pages that has large content.
这是因为您达到了我们的API调用大小限制。每个翻译的大小限制为10K个字符。
This is because you are hitting our API call size limit. Each translation has a size limit of 10K characters.
在这种情况下,您需要细分"sourceText"。分成多个块
In this case, you need to break down the "sourceText" into multiple chunks
这篇关于Microsoft Translator是否设计用于翻译整个网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!