diff options
| author | Nick Mathewson <nickm@torproject.org> | 2006-11-26 06:20:09 +0000 |
|---|---|---|
| committer | Nick Mathewson <nickm@torproject.org> | 2006-11-26 06:20:09 +0000 |
| commit | c588e8997dffc7e8dbf0f54b94c79261314ae2d8 (patch) | |
| tree | f1bdd5e1badadf48e28afe68add04fe2b7f953b1 /metaphone.py | |
| parent | adc4079a71c331fcb5c0d506a9d152307b5daeb2 (diff) | |
| download | anonbib-c588e8997dffc7e8dbf0f54b94c79261314ae2d8.tar.gz | |
r9810@Kushana: nickm | 2006-11-26 01:19:14 -0500
Code cleanups suggested by pychecker; some quite brain-dead.
svn:r187
Diffstat (limited to 'metaphone.py')
| -rw-r--r-- | metaphone.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/metaphone.py b/metaphone.py index e86d4fc..8eb8257 100644 --- a/metaphone.py +++ b/metaphone.py @@ -9,8 +9,6 @@ Based on the original C++ metaphone implementation.) """ -import string - TRIPLES = { 'dge': 'j', 'dgi': 'j', @@ -62,7 +60,7 @@ def metaphone(s): # Change "x" to "s" if s[0] == 'x': - x = "s%s" % s[1:] + s = "s%s" % s[1:] # Get rid of "h" in "wh". if s[:2] == 'wh': @@ -118,15 +116,13 @@ def metaphone(s): vowelBefore = prevLtr in "aeiou" curLtr = s[idx] - nextLtr2 = nextLtr3 = ' ' + nextLtr2 = ' ' if idx < lastChar: nextLtr = s[idx+1] vowelAfter = nextLtr in "aeiou" frontvAfter = nextLtr in "eiy" if idx+1 < lastChar: nextLtr2 = s[idx+2] - if idx+2 < lastChar: - nextLtr3 = s[idx+3] else: nextLtr = ' ' vowelAfter = frontvAfter = 0 |
