Algorithm behind typo corrections in Google Search
Asked Answered
S

2

8

I notice if I make a typo in Google search bar, it is very likely to correct it for me.

Like, if I type "incerdible", it will suggest "incredible", or for "stackovflow", it will be "stackoverflow".

What is the core idea of such algorithm?

Stochmal answered 25/9, 2011 at 2:54 Comment(0)
R
7

Here is an explanation, and some more links with further details:

http://norvig.com/spell-correct.html

Robbery answered 25/9, 2011 at 2:56 Comment(1)
It would be fun to see how a Dvorak keyboard effects the search results.Microvolt
G
2

There are many algorithms to solve that problem. The core algorithm is to calculate the difference between two words. You can take a look at Levenshtein distance, this is a great algorithm to do that.

If you want to use something like that, you can use some npm package like this:

https://www.npmjs.com/package/typo-correction

Gadmon answered 27/4, 2022 at 4:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.