commit 3e6eb41e7c0b2a85b5fd4230cc3801e5d92278b9
parent f577a1e2f79cfe2365521cf5a0d735be54dcccd2
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sat, 21 Sep 2013 11:06:19 +0200
word occurrences with hyphens
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/template.py b/template.py
@@ -1,5 +1,6 @@
import error
import copy
+import re
import rhyme
from verse import Verse
from common import normalize, legal, strip_accents_one, rm_punct
@@ -153,7 +154,7 @@ class Template:
if self.check_occurrences:
if pattern.myid not in self.occenv.keys():
self.occenv[pattern.myid] = {}
- last_word = line_with_case.split(' ')[-1]
+ last_word = re.split(r'[- ]', line_with_case)[-1]
if last_word not in self.occenv[pattern.myid].keys():
self.occenv[pattern.myid][last_word] = 0
self.occenv[pattern.myid][last_word] += 1