GeezerVison is showing github.com — Wrong translate token with multiply words · Issue #73 · lkuza2/java-speech-api
Wrong translate token with multiply words #73DescriptionThanks for you job. I try to use GoogleTranslate class, when i use one keyword all works excelent, but if i try to translate two or more words, token is wrong and google return 403 error. Although @helen5106 php version generate correct token with multiply words, for example:
green=764880.885612
green apple=367137.242333 // correct
and java generated tokens:
green=764880.885612
green apple=80012.462896 // wrong ActivitySkylion007 commented on Jan 18, 2016 @dean1510 What are your thoughts on this issue? @saroyama Let me know if you can find where exactly the codes are differing (via a debugger or something) it likely has to due with a difference of order of operations between PHP and Java.
Unfortunately, I did not work too much on the token generation, but if you can find exactly at what line the code begins to differ, that would prove most helpful. dean1510 commented on Jan 19, 2016 Problem isn't related to TK calculation algorithm. You should run it on original string:
String encoded = URLEncoder.encode(text, "UTF-8"); //Encode
At this time "green apple" is converted to "green+apple"
...
sb.append(generateToken(encoded));
TK is calculated on converted string, not original source => You get an error.
Try use
sb.append(generateToken(text));
instead. Skylion007 commented on Jan 19, 2016 Thanks for the info. I submitted a bugfix and uploaded the latest binaries. saroyama commented on Jan 19, 2016 Skylion007 commented on Jan 19, 2016 @saroyama New binaries seem to be working for me. Green Apple is returning manzana verde. Maybe we need to update generateB to use the West Coast locale? I am using it right now and it appears to be working. dean1510 commented on Jan 19, 2016 @saroyama
ensure you're calling TK exactly on "green apple".
I've changed "+" in your URL to "%20" but it also returns error. saroyama commented on Jan 19, 2016 saroyama commented on Jan 19, 2016 @dean1510 Sorry, i get new class, now all works
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|