• Teaser Home

    Clean Code Developer School

    Saubere Softwareentwicklung üben – regelmäßig, fokussiert, individuell, angeleitet


Application Kata „Spellchecker“

Implement a program that lists all misspelled words from an input file.

The program should be called like the following:

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:

Variation #1

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.

Variation #2

The format of the word list file wordlist.txt should be extended:

The given example leads to the words „you, your, yours“.

Variation #3

Punctuation marks should be handled correctly.