microsoft-translator

How to use Bing Translation API?

↘锁芯ラ 提交于 2019-12-03 05:11:24
问题 I am trying to use the Bing Translation API, but I am confused. There seems to be much possibilities (old and new ones) but I don't understand what I have to do. Can someone please help me? I want to send a HTTP Request like http://api.microsofttranslator.com/V2/Ajax.svc/Translate?appId=<AppId>&to=de&text=World and get the translation. Where to get the AppId? What I have done so far: Signed in for the free API useage (https://datamarket.azure.com/dataset/bing/microsofttranslator) Created an

How to use Bing Translation API?

安稳与你 提交于 2019-12-02 18:27:03
I am trying to use the Bing Translation API, but I am confused. There seems to be much possibilities (old and new ones) but I don't understand what I have to do. Can someone please help me? I want to send a HTTP Request like http://api.microsofttranslator.com/V2/Ajax.svc/Translate?appId=<AppId>&to=de&text=World and get the translation. Where to get the AppId? What I have done so far: Signed in for the free API useage ( https://datamarket.azure.com/dataset/bing/microsofttranslator ) Created an App: https://datamarket.azure.com/developer/applications Now I have the Client_ID and Client_Secret

Obtaining alignment data for English to Chinese

[亡魂溺海] 提交于 2019-12-01 14:57:09
Using TranslateArray2, I am able to get alignment data for most languages I want, but not for English to Chinese (zh). How can I get it? <ArrayOfTranslateArray2Response xmlns="http://schemas.datacontract.org/2004/07/Microsoft.MT.Web.Service.V2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <TranslateArray2Response> <Alignment /> <From>en</From> <OriginalTextSentenceLengths xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <a:int>33</a:int> </OriginalTextSentenceLengths> <TranslatedText>你好我的朋友, 我爱你的唇</TranslatedText> <TranslatedTextSentenceLengths xmlns:a="http:/

How to remove %EF%BB%BF in a PHP string

血红的双手。 提交于 2019-12-01 08:54:30
I am trying to use the Microsoft Bing API. $data = file_get_contents("http://api.microsofttranslator.com/V2/Ajax.svc/Speak?appId=APPID&text={$text}&language=ja&format=audio/wav"); $data = stripslashes(trim($data)); The data returned has a ' ' character in the first character of the returned string. It is not a space, because I trimed it before returning the data. The ' ' character turned out to be %EF%BB%BF. I wonder why this happened, maybe a bug from Microsoft? How can I remove this %EF%BB%BF in PHP? You could use substr to only get the rest without the UTF-8 BOM : // if it’s binary UTF-8

How to remove %EF%BB%BF in a PHP string

依然范特西╮ 提交于 2019-12-01 06:37:46
问题 I am trying to use the Microsoft Bing API. $data = file_get_contents("http://api.microsofttranslator.com/V2/Ajax.svc/Speak?appId=APPID&text={$text}&language=ja&format=audio/wav"); $data = stripslashes(trim($data)); The data returned has a ' ' character in the first character of the returned string. It is not a space, because I trimed it before returning the data. The ' ' character turned out to be %EF%BB%BF. I wonder why this happened, maybe a bug from Microsoft? How can I remove this %EF%BB

decoding the JSON output from Microsoft translator API with PHP

二次信任 提交于 2019-12-01 06:31:36
this issue seems specific to microsofttranslator.com so please ... any answers, if you can test against it ... Using the following URL for translation: http://api.microsofttranslator.com/V2/Ajax.svc/TranslateArray .. I send via cURL some fantastic arguments, and get back the following result: [ { "From":"en", "OriginalTextSentenceLengths":[13], "TranslatedText":"我是最好的", "TranslatedTextSentenceLengths":[5] }, { "From":"en", "OriginalTextSentenceLengths":[16], "TranslatedText":"你是最好的", "TranslatedTextSentenceLengths":[5] } ] When I use json_decode($output, true); on the output from cURL, json

decoding the JSON output from Microsoft translator API with PHP

我是研究僧i 提交于 2019-12-01 04:30:11
问题 this issue seems specific to microsofttranslator.com so please ... any answers, if you can test against it ... Using the following URL for translation: http://api.microsofttranslator.com/V2/Ajax.svc/TranslateArray .. I send via cURL some fantastic arguments, and get back the following result: [ { "From":"en", "OriginalTextSentenceLengths":[13], "TranslatedText":"我是最好的", "TranslatedTextSentenceLengths":[5] }, { "From":"en", "OriginalTextSentenceLengths":[16], "TranslatedText":"你是最好的",