Yahoo Spell Checker API

Another web service available from Yahoo is online spell checker. Thsi service is similar with Yahoo web search: you provide all parameters with REST and get results as XML, JSON or serialized PHP. URL used for this service is http://api.search.yahoo.com/WebSearchService/V1/spellingSuggestion and its description with all parameters is at http://developer.yahoo.net/search/web/V1/spellingSuggestion.html.

Here's an example from JavaScript using JSON:

<script language=JavaScript>
function ws_results(obj) {
alert("Correct spelling of 'someting' is '"+obj.ResultSet.Result+"'");
}
</script>
<script type="text/javascript"
src="http://api.search.yahoo.com/WebSearchService/V1/spellingSuggestion?appid=YahooDemo&query=someting&output=json&callback=ws_results">
</script>

And something similar with serialized PHP:

$request =  'http://api.search.yahoo.com/WebSearchService/V1/spellingSuggestion?appid=YahooDemo&query=someting&output=php';

$response = implode('',file($request));

if ($response === false) {
 die('Request failed');
}

$phpobj = unserialize($response);

echo "Correct spelling of 'someting' is '{$phpobj['ResultSet']['Result']}'"; 

Simply, isn't it? There is the same 5000 queries limit per day per IP for this web service.

Leave a Comment

You must be logged in to post a comment.