I coded a reading experiment, in which words are presented one by one on a screen.
These words are drawn from .txt files, containing German words that are divided into syllables.
The division between syllables is done by means of ‘-’.
So the .txt file contains words like this:
The aim of the program is to correctly show the word, so without the ‘-’:
zweiter Diener etc.
When a word does not contain an Umlaut everything goes fine, using the following code:
# This ensures proper placement of the syllable on the screen# padded_syllable = ' ' * letter_count + syllable + ' ' * ( len( word ) - letter_count - len( syllable ) )
however, the spacing between wordparts goes wrong when a letter contains an umlaut, then this letter seems to be counted as two.
“künst-li-che” is then shown as “künst li che”, where it should be künstliche.
Is there a way to count a letter with Umlaut as one letter only?