You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Vinicius Carvalho <vi...@gmail.com> on 2009/07/07 02:37:25 UTC
Re: Free software for language detection
You can also check google's language API: I'm writing a blog entry on this,
hope to post tomorrow:
http://code.google.com/apis/ajaxlanguage/documentation/reference.html
Here a snippet of it working: (Using Json Simple to decode:
http://code.google.com/p/json-simple/)
try {
String s = URLEncoder.encode("Você sabe como implementar um
serviço", "UTF-8");
URL url = new URL("
http://ajax.googleapis.com/ajax/services/language/detect?v=1.0&q="+s);
BufferedReader in = new BufferedReader(new
InputStreamReader(url.openStream()));
String str;
StringBuilder buffer = new StringBuilder();
while ((str = in.readLine()) != null) {
buffer.append(str);
}
in.close();
JSONObject obj =
(JSONObject)JSONValue.parse(buffer.toString()).get("responseData");
System.out.println(obj.get("language"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
On Sun, Mar 29, 2009 at 6:02 AM, Karl Wettin <ka...@gmail.com> wrote:
> You can also look at https://issues.apache.org/jira/browse/LUCENE-1039that I've successfully used for language detection of user queries.
>
> karl
>
> 27 mar 2009 kl. 18.35 skrev Boris Aleksandrovsky:
>
>
> Lisheng,
>>
>> You might want to look at the Nutch LanguageID plugin
>> (http://wiki.apache.org/nutch/LanguageIdentifier) too.
>>
>> Cheers,
>> Boris
>>
>> On Fri, Mar 27, 2009 at 10:22 AM, Zhang, Lisheng
>> <Li...@broadvision.com> wrote:
>>
>>> Thanks very much!
>>>
>>> -----Original Message-----
>>> From: jochen.scout@gmail.com [mailto:jochen.scout@gmail.com]On Behalf Of
>>> Jochen Frey
>>> Sent: Friday, March 27, 2009 10:04 AM
>>> To: java-user@lucene.apache.org
>>> Subject: Re: Free software for language detection
>>>
>>>
>>> Lisheng,
>>>
>>> Here's a package you could take a look at. I have used it in the past and
>>> it
>>> worked reasonably well. Let me know what else you find and how it works
>>> for
>>> you.
>>>
>>> http://www.olivo.net/software/lc4j/
>>>
>>> Good luck!
>>> Jochen Frey
>>>
>>> On Fri, Mar 27, 2009 at 9:54 AM, Zhang, Lisheng <
>>> Lisheng.Zhang@broadvision.com> wrote:
>>>
>>> Hi,
>>>>
>>>> Are you aware of any free software for language detection (given certain
>>>> text, see if it is French, or Japanese)? I saw Bob Carpenter's previous
>>>> mail which explained the principle nicely, but could not locate free
>>>> tools?
>>>>
>>>> Thanks very much for helps, Lisheng
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> Jochen Frey . CTO
>>> Scout Labs
>>> 415.366.0450
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>
>>>
>>>
>>
>>
>> --
>> Thanks,
>>
>> Boris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
--
The intuitive mind is a sacred gift and the
rational mind is a faithful servant. We have
created a society that honors the servant and
has forgotten the gift.