Microsoft Translator API - notranslate trimming leading space?

早过忘川 提交于 2019-12-25 11:58:14

问题


Moving a question from the old MSDN forum here as it appears to be still open.

https://social.msdn.microsoft.com/Forums/en-US/ce8c4eae-ad14-4835-8537-fc3870538bbe/translator-api-notranslate-trimming-leading-space?forum=microsofttranslator

Is this a known bug, or intentional for any reason?

Are there any workarounds for this issue so that the API does not strip white spaces?

More examples:


回答1:


Translator trims leading and trailing space, and compresses any other white space to a single space. This is by design. Translator needs to move the words around freely to form the newly composed sentence, and wouldn't know what to do with the extra white space. A workaround would be to trim in your code before translation, and then restore the trimmed off pieces afterwards, depending on the context.



来源:https://stackoverflow.com/questions/46273868/microsoft-translator-api-notranslate-trimming-leading-space

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!