In all likelihood, this is because your query string is pushing out past the 
2,000 character limit imposed on GET URLs by Google servers. If you switch to 
the POST method, it will probably work better. But honestly, I don't think I 
would waste too much time on this because the Translate API v1 (which is what 
you're using) will be discontinued on December 1. You will need to migrate to 
the Translate API v2. And as you work on that, be advised that the v2 API will 
be moved to a paid model on December 1 as well. All of this is detailed in the 
documentation. Check it out.

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:
[email protected]

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

On Oct 31, 2011, at 10:39 AM, Sofean wrote:

> Hello all,
> 
> I have used Google language detection API with Twitter stream to
> detect the language  of tweets. When i call the API for single tweet,
> it works well but when  i call the API for many tweets at same time it
> return NULL value.
> any one has  any idea how i can solve this problem?
> 
> Many thanks,
> SOFEAN
> In fact, i call the following  method overtime with incoming tweets.
> public static String googleLangDetection(String str) throws
> IOException, Exception{
> 
> 
>        URI uri = new URI("http","ajax.googleapis.com","/ajax/services/
> language/detect","v=1.0&key=****************&q=\""+str
> +"\"",null);
>        URL url = uri.toURL();
> 
>        URLConnection connection = url.openConnection();
> 
>        String line;
>        StringBuilder builder = new StringBuilder();
>        BufferedReader reader = new BufferedReader(new
> InputStreamReader(connection.getInputStream()));
>        while((line = reader.readLine()) != null) {
>         builder.append(line);
>        }
> 
>        JSONObject json = new JSONObject(builder.toString().trim());
>     return json.getString("responseData");  //
> jsonLang.getString("language").toUpperCase();
>    }
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Google AJAX APIs" group.
> To post to this group, send email to
> [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> To view this message on the web, visit
> http://groups.google.com/group/google-ajax-search-api?hl=en_US
> For more options, visit this group at
> http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
To view this message on the web, visit
http://groups.google.com/group/google-ajax-search-api?hl=en_US
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en

Reply via email to