Spell-Checker: Wrote studying LeetCode 75 Problems
Introduction
Writing Spell-checker is a challenge due to the complicated nature of searching and matching correct matches of user written words. Thus, providing correct spellings.
StackOverflow and Wikipedia offer in-depth knowledge in writing a spell-checker but are quite limited and outdated. It’s quite difficult to reverse engineer the spell checker ones present in Windows 11 by default. Including spell-checker has fundamental rules and later others tweak them to make it faster and add more features.
Establishing no prior rules how it should work, and present Neural Spell Checkers being prominent in Grammarly and Google Docs, I went on quest to write a spell checker from scratch using my understanding of Algorithms specifically LeetCode problems I solved in the past couple of weeks and reading through Articles.
Structure of SpellChecker
A unique and similar structure of past and present spell checkers were derived while designing this Algorithm. Starting
- A Prefix Tree search Algorithm to load every word from the dictionary into its respective nodes
- Iterating over the words and using Longest Common Sequence (LCS) to find most likely match for the input word
- Edit Distance (Levenshtein Distance) to determine the perfect match and returning result.
Word with highest LCS and lowest Edit distance is determined as a perfect match.
Learning outcomes
Practising LeetCode concepts in a real world project is valuable. Including better understanding how different Algorithms come into play and work to solve a critical problem in a unified manner. And showcasing problem solving and creativity traits.
LeetCode Problems (used)
- Edit Distance
- Longest Common Sequence
- Implement a Trie
These were part of LeetCode 75 Problems. https://leetcode.com/studyplan/leetcode-75/
Critical Pointers
- I don’t provide UI and interface to interact with the algorithm. A terminal interface needs to be utilised.
- A Public dictionary dataset was used.
- The clearest explanation of Spell Checker Algorithm and Code on the Internet.
- Time Complexity O(n * m * (m + m))
Consider star the repository if it helps you!
Metadata
Release files for spell4checker 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spell4checker-0.0.1.tar.gz | 3.1 kB | Without provenance | Details for spell4checker-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spell4checker-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for spell4checker-0.0.1-py3-none-any.whl |
Total release size: 6.5 kB
Release files / spell4checker-0.0.1.tar.gz
| Download URL | spell4checker-0.0.1.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8236cdc69a5c7d0be56ac455f7ad7ad11689eba1f6520217a73d5402205dd0f2
|
|
BLAKE2b-256 checksum How to use checksums |
d10bd8f9bfd261a8689292b1f86a7c091a15c128525dabdcfcd4bb38a5c57bb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.10
|
Release files / spell4checker-0.0.1-py3-none-any.whl
| Download URL | spell4checker-0.0.1-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
993df0558990d83177c9e22eac7cb9a85474dd22207fe30e420b98a4f9d4604a
|
|
BLAKE2b-256 checksum How to use checksums |
72875389239721cace83a720fc510e31603c52d3b0b43f4b5a0b2d036e836456
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.10
|
Security for spell4checker 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.