Unparalleled suite of productivity-boosting Web APIs & cloud-based micro-service applications for developers and companies of any size.

APIAutomation

How To Easily Implement “Did You Mean This” In Your App?

Did you Mean This API by APILayer

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.

did you mean this feature
“Did you Mean This” API by APILayer

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.

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.

did you mean this API
Spell Checking Functionality

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.

did you mean this
APILayer Marketplace

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.

API Live Playground

Here are examples implemented in JavaScript and Python programming languages.

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.

REST Debugger – RAD Studio
LiveBindings Designer – RAD Studio

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.

After writing this code, you can save the project and build/test the application.

“Did you Mean This” API Integration in Delphi FireMonkey 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.

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

Related posts
API

An Introduction To Email APIs And How You Can Use Them

API

IP Targeting: An Important Marketing Tool For Your Business

API

Automating Tasks with APIs

APIPython

How To Use Google Trends API With Python?

Leave a Reply

Your email address will not be published.