Jeopardy: minor regex tweak.

This commit is contained in:
Gordon Shumway 2020-02-12 16:29:48 -05:00 committed by GitHub
parent 657ee74863
commit 2292e5fe9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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)