[distances] Correct an IndexError in the soundex code (related #128982)
authorSimon Chabot <simon.chabot@logilab.fr>
Wed, 17 Oct 2012 11:55:23 +0200
changeset 7 1ef125353e35
parent 6 8901ce94c1d3
child 8 fa36d8b3e6dd
[distances] Correct an IndexError in the soundex code (related #128982) As far as we don't know if word[i + 2] is consonant, we use get because it can be a vowel (and crash…)
distances.py
--- a/distances.py	Wed Oct 17 11:53:17 2012 +0200
+++ b/distances.py	Wed Oct 17 11:55:23 2012 +0200
@@ -72,7 +72,7 @@
            consonnantscode[word[i]] == consonnantscode.get(code[-1], ''):
             continue
         if i + 2 < len(word) and word[i + 1] in 'WH' and \
-           consonnantscode[word[i]] == consonnantscode[word[i + 2]]:
+           consonnantscode[word[i]] == consonnantscode.get(word[i + 2], ''):
             continue
         code += word[i]