简体   繁体   English

SRT时间戳中的Microsoft Translator Minutes已在荷兰语翻译中删除

[英]Microsoft Translator Minutes in a SRT timestamp gets removed in Dutch translation

Uri: https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=NL&from=EN&category=General&textType=html Uri: https ://api.cognitive.microsofttranslator.com/translate api-version = 3.0 to = NL from = EN category = General textType = html

Example Text (JSON) Content: [{"text":"00:03:00.300 --> 00:03:08.300 "}] 示例文本(JSON)内容:[{“ text”:“ 00:03:00.300-> 00:03:08.300 ”}]

Result: [{"translations":[{"text":"00:03:00.300--> 00:08.300 ","to":"nl"}]}] 结果:[{“ translations :: [{” text“:” 00:03:00.300-> 00:08.300 “,” to“:” nl“}]}}]

In the result, the 3 in the minutes spot is simply removed from the result... Only in the end time slot. 结果,分钟数中的3点仅从结果中删除...仅在结束时隙中。 Oddly enough, this appears to only happen for the number 3. 奇怪的是,这似乎只发生在数字3上。

Question : Is there any reason Dutch would have this behavior? 问题 :荷兰人有这种行为有什么原因吗? Is it a bug in the translator service? 这是翻译服务中的错误吗? I tested with a few other languages and it seems specific to Dutch. 我用其他几种语言进行了测试,它似乎特定于荷兰语。

I'm not doing anything particularly fancy in the code. 我没有在代码中做任何特别花哨的事情。 The responseBody below already contains the odd data coming back. 下面的responseBody已经包含返回的奇数数据。

        using (var httpClient = new HttpClient())
        {
            using (var request = new HttpRequestMessage())
            {
                request.Method = HttpMethod.Post;
                request.RequestUri = new Uri(uri);
                request.Content = new StringContent(requestBody, Encoding.UTF8, "application/json");
                request.Headers.Add("Authorization", token);

                var response = await httpClient.SendAsync(request);
                var responseBody = await response.Content.ReadAsStringAsync();
                if (response.IsSuccessStatusCode)
                {
                    //Logic on success
                }
            }
        }

Let me know if there's any other information needed. 让我知道是否还有其他需要的信息。 This seems like a particularly odd result. 这似乎是一个特别奇怪的结果。

It can happen that an arbitrary string produces arbitrary "translations". 任意字符串可能会产生任意“翻译”。 Best to avoid passing the time stamp to translation. 最好避免将时间戳传递给翻译。 With SRT file translation there is more to consider besides the time stamp. 使用SRT文件翻译时,除了时间戳之外,还需要考虑其他因素。 You also need to combine multiple lines into a single line before translation, and then split them again after translation. 您还需要在翻译之前将多行合并为一行,然后在翻译后再次将其拆分。

Here is an example that does both of these: https://github.com/MicrosoftTranslator/DocumentTranslator/blob/master/TranslationAssistant.Business/SRTTranslationManager.cs 这是一个同时执行这两个操作的示例: https : //github.com/MicrosoftTranslator/DocumentTranslator/blob/master/TranslationAssistant.Business/SRTTranslationManager.cs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM