Sticky Posts
Apr 9, 2009
elHttpClient + Google Ajax API = Language Detection
Google offers some cool AJAX APIs that can do a bunch of things and today we cover language detection. When you ... let's say ... scrape ... text sometimes you could use a sentence of few words to verify the language. This is not easy viable to do on your own but Google offers a way. It's probably part of the Globalization Agenda Google's part of but I won't discuss this here. Just enjoy it!
What Language Detection Does?
You access an URL using a certain query and it will tell you the probability of that text fitting a certain language. I'd say it's pretty accurate as I tested eat shit (in my language) and it was correct ;) Passing such a difficult yet highly relevant test is actual proof that it works beyond reasonable doubt.
It's accessed using GET hence tested text can't be too long. Several words will do (for me, anyways). Keep this in mind when you build your tools.
Less Chit-Chat ... More Language Detection Code
The code uses elHttpClient. Make sure you have it.
Registration is FREE, quick, painless and worth its weight in gold.
PS: I'm wondering. Is my comment form broken or am I not leaving room for comments? :)


no comment
test comment.
There, nothing wrong with your form.
BTW, do you always moderate all comment? I believe last time I post comment here, I don’t have Your comment is awaiting moderation. message, maybe I forgot ;)
I always moderate because I get to see the new comments … in yellow … and read them and reply :)
I’m not sure how it looks if I don’t moderate and it’s easier like this.
I also get to remove links that are not really good to be placed here.
I remove niche sites and so on where I consider posting them here is actually a risk for your profits.
just found you website/ blog and I have to say I love your mini scripts.