From 2292e5fe9d1fff73995e49df297b7d3acd136f28 Mon Sep 17 00:00:00 2001 From: Gordon Shumway Date: Wed, 12 Feb 2020 16:29:48 -0500 Subject: [PATCH] Jeopardy: minor regex tweak. --- Jeopardy/plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jeopardy/plugin.py b/Jeopardy/plugin.py index d97ea2b..8f54c23 100644 --- a/Jeopardy/plugin.py +++ b/Jeopardy/plugin.py @@ -169,7 +169,7 @@ class Jeopardy(callbacks.Plugin): if clue and airdate and answer and category and not invalid and id not in asked and id not in self.history[channel]: q = "{0}|{1}|{2}|{3}|{4}|{5}".format(id, airdate, points, category, clue, answer) q = re.sub('<[^<]+?>', '', fix_text(q, normalization='NFKC')).replace(r"\'", "'").replace(r'\"', '"') - q = re.sub('([,;:.!?])(\w|\"|\'|\()(?![.\'])', '\g<1> \g<2>', q) + q = re.sub('([,;:.!?)])(\w|\"|\'|\()(?![.\'])', '\g<1> \g<2>', q) q = re.sub('(\$\d+[,.]) (\d+)', '\g<1>\g<2>', q) q = " ".join(q.split()) self.questions.append(q) @@ -179,7 +179,7 @@ class Jeopardy(callbacks.Plugin): if clue and airdate and answer and category and not invalid and id not in asked: q = "{0}|{1}|{2}|{3}|{4}|{5}".format(id, airdate, points, category, clue, answer) q = re.sub('<[^<]+?>', '', fix_text(q, normalization='NFKC')).replace(r"\'", "'").replace(r'\"', '"') - q = re.sub('([,;:.!?])(\w|\"|\'|\()(?![.\'])', '\g<1> \g<2>', q) + q = re.sub('([,;:.!?)])(\w|\"|\'|\()(?![.\'])', '\g<1> \g<2>', q) q = re.sub('(\$\d+[,.]) (\d+)', '\g<1>\g<2>', q) q = " ".join(q.split()) self.questions.append(q) @@ -238,7 +238,7 @@ class Jeopardy(callbacks.Plugin): if clue and airdate and answer and category and not invalid and id not in asked and id not in self.history[channel]: q = "{0}|{1}|{2}|{3}|{4}|{5}".format(id, airdate, points, category, clue, answer) q = re.sub('<[^<]+?>', '', fix_text(q, normalization='NFKC')).replace(r"\'", "'").replace(r'\"', '"') - q = re.sub('([,;:.!?])(\w|\"|\'|\()(?![.\'])', '\g<1> \g<2>', q) + q = re.sub('([,;:.!?)])(\w|\"|\'|\()(?![.\'])', '\g<1> \g<2>', q) q = re.sub('(\$\d+[,.]) (\d+)', '\g<1>\g<2>', q) q = " ".join(q.split()) self.questions.append(q) @@ -249,7 +249,7 @@ class Jeopardy(callbacks.Plugin): if clue and airdate and answer and category and not invalid and id not in asked: q = "{0}|{1}|{2}|{3}|{4}|{5}".format(id, airdate, points, category, clue, answer) q = re.sub('<[^<]+?>', '', fix_text(q, normalization='NFKC')).replace(r"\'", "'").replace(r'\"', '"') - q = re.sub('([,;:.!?])(\w|\"|\'|\()(?![.\'])', '\g<1> \g<2>', q) + q = re.sub('([,;:.!?)])(\w|\"|\'|\()(?![.\'])', '\g<1> \g<2>', q) q = re.sub('(\$\d+[,.]) (\d+)', '\g<1>\g<2>', q) q = " ".join(q.split()) self.questions.append(q)