[distance] Don't read letters uselessly to compute the soundexcode
authorSimon Chabot <simon.chabot@logilab.fr>
Tue, 20 Nov 2012 15:44:42 +0100
changeset 159 ec8c2443c2b8
parent 158 a6449ca99bbf
child 160 b14aef9056f1
[distance] Don't read letters uselessly to compute the soundexcode
distances.py
--- a/distances.py	Tue Nov 20 15:17:38 2012 +0100
+++ b/distances.py	Tue Nov 20 15:44:42 2012 +0100
@@ -157,6 +157,9 @@
            consonnantscode[word[i]] == consonnantscode.get(word[i + 2], ''):
             continue
         code += word[i]
+        if len(code) > 4:
+            break
+
     #Replace according to the codes
     code = code[0] + ''.join([consonnantscode[c] for c in code[1:]])
     ###First four letters, completed by zeros