I've created a spell checker that reads through a text file and detects misspelled/not existing words and returns those words to the user.
The spell checker is working based on a trie data structure. This data structure allows me to search for words a lot faster than in comparison with a linked list (mapped)
How does the spell checker work?
The current version of the spell checker doesn't have a form of UI yet and has to be used from the command line. The user can run the following command: "./speller [text file]". Once the user entered the command in the command line the program will execute and print the misspelled words to the console.
The program's output
How does the spell checker work under the hood?
Once the spell checker starts execution it immediately executes the function that loads a dictionary into memory (as a trie). Once the dictionary has been loaded into memory successfully the program starts reading every word in the text file. For every valid word (the word can only contain alphabetic characters and apostrophe) that the program reads, it calls a check function that checks if the word is correct. The check function does this by searching the character combination of the current word in the trie. If the combination does not exist or the program has reached the end of the current word to check and the trie says it's not a word; then the program returns false(we let the main program know we've marked the word as misspelled). Once the program has read through the whole text file and printed all misspelled words to the console we start unloading the dictionary from the memory. This is done by a recursive function (code can be found at the bottom of this page).