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