commit a2dc431e2d39f50220fc9d6687c6a231ebacd0bd
parent c31d697d35c122840da5191f00a9c97975a366e1
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sun, 5 Jan 2014 02:52:06 +0100
fix problem with hyphen between vowels
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/verse.py b/verse.py
@@ -138,9 +138,10 @@ class Verse:
# remove empty chunks created by simplifications
for i, w in enumerate(self.chunks):
self.chunks[i] = [x for x in w if len(x['text']) > 0]
+
# remove leading and trailing crap
for w in self.chunks:
- for p in [0, -1]:
+ for p in range(len(w)):
while len(w[p]['text']) > 0 and w[p]['text'][0] in ' -':
w[p]['text'] = w[p]['text'][1:]
while len(w[p]['text']) > 0 and w[p]['text'][-1] in ' -':
@@ -409,7 +410,7 @@ class Verse:
ok = False
try:
for i in range(2):
- if '-' in self.chunks[pos-i-1]['text'] or 'wordend' in self.chunks[pos-i-1]:
+ if '-' in self.chunks[pos-i-1]['original'] or 'wordend' in self.chunks[pos-i-1]:
ok = True
except IndexError:
pass