Application Kata "Spellchecker"

Write a program that lists all misspelled words in an input file.

The program is called up as follows:

C:> spellchecker mytext.txt
apples
Dskette

In the example, the two words "Äppel" and "Dskette" are misspelled. The rule as to which words are misspelled is very simple: all correct words are in the wortliste.txt file. Any word in the input text that is not in the word list file is output as misspelled.

The word used in the input file is a continuous string of characters that does not consist of spaces, line feeds and tabs. Punctuation marks are initially ignored (see variation 3).

In the word list file, each word is on a separate line. It is a text file in UTF8 encoding. The file could look like this:

The
diskette
Apple
trunk
falls
far
not
is
use
in

Variation #1

For each misspelled word, the position at which the word is located in the text is displayed. The position is specified with line and column, both 1-based.

C:> spellchecker mytext.txt
Äppel-1, 24
Dskette-3, 1

Variation #2

The file format of the word list file wortliste.txt is to be extended to make it easier to map word variants:

his ~e ~er ~em ~es

The example leads to the words "his, his, his, his, his".

Variation #3

Punctuation marks are handled correctly when dividing the text into words.

 

 

 

 

 

 

 

Enter your headline here

en_USEnglish