About

Command Line Spell Checker in C

*Code and demos available upon request*

Overview of Command Line Spell Checker in C

For the Algorithms and Data Structures class, I developed a full-fledged command line spell checker in C. The project, although ostensibly focused on dynamic programming, served as a culmination of various concepts, requiring the integration of dynamic memory allocation, complex data structures, and meticulous attention to avoiding memory leaks.


Motivation:
Driven by the educational context, this project pushed the boundaries of my understanding of algorithms and data structures. Despite the option for a simplified version, I chose the more intricate path to deepen my knowledge and challenge my programming skills.

Implementation:
The heart of the spell checker lies in a dynamic programming algorithm that calculates the edit distance from an imported dictionary of words, identifying misspelled words in an input file. To enhance efficiency, the dictionary is sorted and then a binary search is employed to locate words in it. A noteworthy technical hurdle was handling input files, especially seamlessly replacing misspelled words with their correct counterparts in the output file.

User Interaction:
Users interact with the spell checker via the command line, providing input files for spell-checking. The tool intelligently processes each word, utilizing the dynamic programming algorithm and binary search to offer accurate suggestions for corrections.

Testing and Validation:
Rigorous testing against both professor-provided files and self-generated edge cases ensured the spell checker's accuracy and robustness. This iterative testing process fine-tuned the tool, making it reliable in diverse scenarios.

Challenges Faced:
A standout challenge was handling input files for spell-checking. I solved this issue by going though by each individual character and seeing if it was a letter or not. if it was a letter I added it to an array. If it was not I copied it straight to the output file. When there was a non-letter and then letters and then another non-letter I knew it was a word and I would check it against the dictionary that was stored in an array.

Learning Experience:
This project stands as a testament to overcoming challenges in C programming, dynamically managing memory, and implementing complex algorithms. The pride derived from its successful completion reinforces the value of perseverance and the mastery of diverse programming skills.

Images

a screenshot of some command line text that shows how the spell checker works

You give the command line two words and it compares them to find the edit distance. Then when you type -1 -1 instead of words it asks you for a dictionary file, a file to spell check, and if you want verbose mode or not. It then sorts the dictionary so you can use binary search on it.

A screenshot of the command line that shows how the spell checker works

Then it parses through the file you gave it to spell check and looks for the most similar words and gives you a list of options since it's currently in verbose mode it also shows the words it looks at during the search. You can select a word from the list it gives you to replace the misspelled word with.

A screenshot of the command line that shows how this project works

These two shots are the same thing as the last only not in verbose mode and with a larger file.

A screenshot of the command line that shows how the spell checker works