[distance] Soudex : if there is a vowel between two identical numbered
authorSimon Chabot <simon.chabot@logilab.fr>
Wed, 17 Oct 2012 11:53:17 +0200
changeset 6 8901ce94c1d3
parent 5 a6cd77422ee0
child 7 1ef125353e35
[distance] Soudex : if there is a vowel between two identical numbered consonants, count those consonants twice. (related #128982)
distances.py
--- a/distances.py	Wed Oct 17 11:51:42 2012 +0200
+++ b/distances.py	Wed Oct 17 11:53:17 2012 +0200
@@ -68,7 +68,8 @@
     for i in xrange(len(word[1:])):
         if word[i] in vowels:
             continue
-        if consonnantscode[word[i]] == consonnantscode.get(code[-1], ''):
+        if word[i - 1] not in vowels and \
+           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]]: