Application Kata „Spellchecker“
Implement a program that lists all misspelled words from an input file.
The program should be called like the following:
C:> spellchecker mytext.txt Appel Hrddisk
In this example the words „Appel“ and „Hrddisk“ are misspelled. The rule which words are correct is very simple: all correct words come from the text file wordlist.txt. Each word from the input text that is not found in this file is considered misspelled.
A word is defined as a number of consecutive characters that don’t contain whitespace or line delimiters. Punctuation marks are ignored (see variation 3).
In the word list file each word stands on its own line. It is a simple text file in UTF8 encoding. See the following example:
The apple does fall harddisk rotates fast
Each misspelled word is printed with the position of the word in the input text. The position is given as line and column, both 1-based.
C:> spellchecker mytext.txt Appel – 1, 24 Hrddisk – 3, 1
The format of the word list file wordlist.txt should be extended:
you ~r ~rs
The given example leads to the words „you, your, yours“.
Punctuation marks should be handled correctly.