
Do you know what Yahoo Spelling Service is?
As it turned out, this is a very handy thing from the Yahoo Developer Network.
It is very simple to use it - simply, strictly speaking, there is no place:
search.yahooapis.com/WebSearchService/V1/spellingSuggestion?appid=YahooDemo&query=tennesee
Since Habr cuts the link (although it is quite possible to click on it for general educational purposes, it is not scary!), Let's sort it out in parts:
search.yahooapis.com
All requests to
YDN begin with this host.
/WebSearchService/V1/
The name of the service and its version. Honestly, kill me I do not remember a single V2 service, but - obviously - reserved for future versions.
/spellingSuggestion
The name of the method being called. For example, for ordinary search, you should use the
/webSearch
method
Further, as in the most usual GET request (which this call, strictly speaking, is, parameters follow). There are two main parameters for YSpelling:
- appid - Application ID. Each application that uses the Yahoo API must have a unique identifier. Read more about it here.
- query - Query, the actual query. As a rule - the word, and as a rule - in English.
There are also two additional parameters -
output , which regulates in what format the data will be returned (XML, JSON and Serialized PHP are supported), and
callback is the name of the JavaScript function in which the resulting JSON will be wrapped.
')
In response to such a call, the Yahoo Spelling Service will return a very simple answer. In the case of JSON, it will look like this:
{"ResultSet":{"Result":"tennessee"}}
I didn’t give XML, because Habr still zazhezhu it, but for clarity, JSON is not worse.
More information about the service can be read on the
official page , from myself I will add that it will certainly be useful not only for writing simple spell checking systems, but also for correcting user input.
PS In fact, Yahoo has quite a few useful services. If people are interested, I can write several articles about them, since it is easier for me to find developers and ask them questions. What do you think?