commit 04d4adceec2a56af11971a10662a2b45b72b16d3
parent 4fcb09bc8d8138debb8a18b5cfa74386333c8e12
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Mon, 9 Apr 2012 11:22:08 +0200
remove digits to prevent lags in rhyme
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/common.py b/common.py
@@ -47,7 +47,9 @@ def rm_punct(text, with_apostrophe = False):
text = re.sub("'", '', text)
#TODO rather: keep only good chars
pattern = re.compile("[^'\w -]", re.UNICODE)
- return pattern.sub(' ', text)
+ text2 = pattern.sub(' ', text)
+ pattern2 = re.compile("[0-9]", re.UNICODE)
+ return pattern2.sub('', text2)
def is_vowels(chunk, with_h=False, with_y=True):
"""Test if a chunk is vowels