commit ef3830806ac06c8f38b9f61d9d4ac1514e6a0e0d
parent 462460b4d90f41d09972e2e8e9e446090920ac0e
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Mon, 12 Aug 2019 18:19:52 +0200
do not remove space after apostrophes
caused problems when apostrophes denote elision
Diffstat:
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/common.py b/common.py
@@ -46,7 +46,6 @@ def norm_spaces(text):
def rm_punct(text, rm_all=False, rm_apostrophe=False, rm_apostrophe_end=True):
"""Remove punctuation from text"""
text = re.sub("[" + apostrophes + "]", "'", text) # no weird apostrophes
- text = re.sub("' *", "'", text) # space after apostrophes
if rm_apostrophe:
text = re.sub("'", "", text)
if rm_apostrophe_end:
diff --git a/verse.py b/verse.py
@@ -141,7 +141,7 @@ class Verse:
self.chunks2 = []
acc = []
for w in self.chunks:
- if re.search("[" + apostrophes + "]\s*$", w[-1]['original']):
+ if re.search("[" + apostrophes + "]$", w[-1]['original']):
acc += w
else:
self.chunks2.append(acc + w)