Rub shoulders with leading experts and industry disruptors at TNW Conference →

The heart of tech

This article was published on August 17, 2011


Google inadvertently creates a ‘Profanity API’

Google inadvertently creates a ‘Profanity API’
Martin Bryant
Story by

Martin Bryant

Founder

Martin Bryant is founder of Big Revolution, where he helps tech companies refine their proposition and positioning, and develops high-qualit Martin Bryant is founder of Big Revolution, where he helps tech companies refine their proposition and positioning, and develops high-quality, compelling content for them. He previously served in several roles at TNW, including Editor-in-Chief. He left the company in April 2016 for pastures new.

Google has inadvertently created an API that third-party developers can use to check whether a word entered by a user is likely to be offensive or not.

While Google’s recently launched What Do You Love? site was a neat showcase for some of the company’s services, what interested developers was the list of profanities in its Javascript code – it was essentially an official Google list of what was and wasn’t a swear word. The list quickly got hidden, but that’s where things get really interesting.

As James Wade of Phurix Labs points out today, by switching the profanity check to a URL lookup, Google has essentially created a ‘profanity API’ that any developer can use in his or her own apps. Entering the URL http://www.wdyl.com/profanity?q=xxx (changing the text after the ‘?=’ to whatever word you want to check) you can find out whether a word is profane in Google’s eyes or not, getting the response ‘True’ or ‘False’.

As Wade notes, a simple snippet of PHP code can be used with apps via a JSON call to query whether or not Google thinks any given text contains rude words. For developers wanting to keep content in their apps and on their websites clean, this saves them having to write and host their own list of profanities.

The technique relies on Google keeping What Do You Love? live in its current form, so it might not be wise to rely on it for widely deployed code, but it’s an interesting hack and one it would be great to see Google offer officially. After all, as a company that aims to organise the entire sum of human knowledge, surely Google should have the best profanity list in the world, right?