
Anybody who uses the internet has already seen and used spell checkers and auto-correction. For instance, if you type “developrs”, Google says: “did you mean developers“. In addition to correcting your spelling errors, the technology provides you with the most likely contents and search results based on that guess. In this tutorial, you will learn how to implement this – “Did you Mean This” functionality in your systems.

If you are a developer like us, you might consider implementing the same functionality in your system. There are various ways to create or integrate this – “Did you Mean This …?” feature.
Here in this tutorial, you will learn how to create this feature using Python and Delphi programming languages.
Table of Contents
What Is Spell Checker?
When you type something into your computer, the spell checker takes a look to see if there are any typos. As you know, a word processor, email client, dictionary, or search engine usually includes a built-in spell checker.

How Does A Spell Checker Work?
A standard spelling checker performs the following actions.
It analyzes your document and pulls out the words it finds. Next, it checks each word against a database of known, correct spellings (i.e. a dictionary). This could be a list of words or include hyphenation marks and possibly even lexical and grammatical attributes.
You can also improve its credibility by using a language-dependent algorithm for handling morphology. This is because the spell checker will need to consider different forms of the same word, such as plurals, verbal forms, contractions, and possessives.
What Algorithms Does The Spell Checker Function Utilize?
There are many algorithms designed for spell checks. For instance, approximate string matching algorithms like the Levenshtein distance are very popular.
In some cases, spell checkers use a fixed list of misspellings and suggestions for those misspellings. Clustering algorithms combined with phonetic information are also used for spell-checking.
Peter Norvig (from Google) has a detailed article that explains how to build a simplified version of Google’s spell checker. The best part is that it only requires 20 lines of Python code to create. You can see the source code on his blog.
Rather than developing your own program from scratch, however, using RESTful web services, you can easily connect endpoints and have them do the hard work for you. For example, “Did you Mean This?” API by APILayer is here to help you to implement this feature in seconds.
What Is A “Did you Mean This” API?
Did you Mean This API – this famed Google feature is a powerful way to correct your users and improve their results. The API is convenient to embed in your application. When used together with the NLP API, they are a powerful duo.
How To Get Started With “Did you Mean This” API?
Just head over to the Did you Mean This API official page on APILayer by following this link! Then sign up with a free subscription plan. The free subscription plan provides you to test out the API before really investing in this “Did you Mean This” API.

How To Integrate “Did you Mean This” API?
“Did you Mean This?” API by APILayer uses the REST architectural style. The API also uses conventional HTTP response codes, authentication, and verbs. It has logical, resource-oriented URLs, it accepts form-encoded request bodies, and sends back responses in JSON format.
If you go to the documentation page, you can see a Live API Playground where you can test and learn how the API works.

Here are examples implemented in JavaScript and Python programming languages.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
var myHeaders = new Headers(); myHeaders.append("apikey", "fcJayhAH6gUJKakMMahMkYFleADuIRNX"); var requestOptions = { method: 'GET', redirect: 'follow', headers: myHeaders }; fetch("https://api.apilayer.com/dymt/did_you_mean_this?q={q}", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error)); |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import requests url = "https://api.apilayer.com/dymt/did_you_mean_this?q={q}" payload = {} headers= { "apikey": "fcJayhAH6gUJKakMMahMkYFleADuIRNX" } response = requests.request("GET", url, headers=headers, data = payload) status_code = response.status_code result = response.text |
How To Integrate “Did you Mean This” API Into Your Delphi Project?
First of all, you should install the latest version of Delphi. Here you can download Delphi Community Edition. Then you can create your first Multi-Device Delphi FireMonkey application from the wizard.

The Delphi Community Edition comes with the REST Debugger tool, where you can test any RESTful API. Moreover, you can use the Copy Components function to easily create REST client components for your Delphi or C++ Builder project. Below, you can see that I’ve connected to the API and used the Copy Components button to get pre-configured components. Then you can drop them into the form and easily connect to the API without writing code.


But here, I will write a few lines of code that help us make various API requests to the endpoint. Since we have already configured the component available on the form, we’ll make a few changes, like removing parameters and changing the request body every time use changes on the application. Here is the self-explanatory code written in Delphi.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
uses System.JSON; procedure TFormMain.Button1Click(Sender: TObject); begin RESTClient1.ResetToDefaults; RESTClient1.Accept := 'application/json'; RESTClient1.AcceptCharset := 'UTF-8, *;q=0.8'; RESTClient1.BaseURL := Format('https://api.apilayer.com/dymt/did_you_mean_this?apikey=%s&q=%s', [Edit1.Text, Edit2.Text]); RESTResponse1.ContentType := 'application//json'; Memo1.Lines.Clear; RESTRequest1.Execute; end; |
After writing this code, you can save the project and build/test the application.

You can get the complete source code from this repository [1]. Moreover, check out our other tutorials and articles to learn about other API services.
- How To Detect Bad Words From A Text – Automate Via API
- How To Validate IBAN And SWIFT Numbers Using An API
- How To Rewrite And Enhance Any Article Using Paraphraser AI
Why Should You Integrate “Did you Mean This” API?
As you can see, integrating this API helps to improve your whole system. When it comes to user experience, it is also beneficial. Head over now to the official web page of the API and get your free API access key!
[1] https://github.com/MuminjonGuru/DidyouMeanThisAPI