Subject: | Text::Phonetic::Koeln handles consecutive codes wrong |
Date: | Mon, 16 Oct 2017 19:05:08 +0200 |
To: | bug-Text-Phonetic [...] rt.cpan.org |
From: | Stefan Daschek <stefan [...] daschek.net> |
Following the description in Wikipedia, encoding the string "hoffmann"
should result in "0366":
h o f f m a n n
raw encode:
- 0 3 3 6 0 6 6
remove consecutive codes:
0 3 6 0 6
remove zeroes (except leading):
0 3 6 6
However, Text::Phonetic::Koeln returns "36" instead (this is even
reflected in one of the test cases).
The problem seems to by related to the commented-out lines 50-55 and
153. For me the removal of this lines looks like some kind of
optimization ("hey, if we remove all the zeroes in the end, we can
simply skip adding them in the first place, can't we?"), but
unfortunately it alters the algorithms behaviour :-)
Cheers,
Stefan