Handling Correctly Spelled Words
Throughout this chapter, you’ve focused on building a spellchecker with the assumption most words would need to be compared against the entire dictionary to find misspellings. In reality, most words in most documents are spelled correctly, and we could avoid doing a lot of work if we identify correctly spelled words before calculating the edit distance to potential candidate corrections.
Use what you’ve learned in this chapter to update your spellchecker to skip looking for corrections for words that are already spelled correctly.
Hint: Consider using the hashable library to generate a unique identifier for each string in your dictionary.
Remembering Common Typos
When a user is typing a long document, it’s common that they will make certain mistakes many times. For example, a user might habitually omit particular double letters, or be prone to transposing certain letter sequences (for example typing “teh” instead of “the”). Update your spellchecker to remember misspellings and their corrections, rather than doing a complete search each time the misspelling is encountered.
Spellchecking in HCat
Use what you’ve learned in this chapter to add interactive spellchecking to the HCat application you built earlier, when learning about IO .
Footnotes
[20]
https://github.com/en-wl/wordlist
[21]
https://hackage.haskell.org/package/vector
Copyright © 2023, The Pragmatic Bookshelf.