Search code examples
spell-checkingtriesystem-design

Designing a System that would detect typos and suggestions


This was asked in an interview.

I think the answer can be done by constructing a trie of all valid words and then suggestions can be made based on a possible valid path which was otherwise given as incorrect.

Say if user types apfle, and system would detect that after ap a possible valid path was app, which would then satisfy apple.

Is there any better solution than this? Perhaps the one implemented by spell checkers.


Solution

  • See:

    How does the Google "Did you mean?" Algorithm work?

    How do I approximate "Did you mean?" without using Google?

    How to write a spelling corrector

    Youtube Video: Search 101