Jeopardy: add space after punctuation if needed.

This commit is contained in:
oddluck 2020-02-05 16:48:29 +00:00
parent c3d3d27edc
commit 9c8bc3d12e
1 changed files with 4 additions and 0 deletions

View File

@ -163,6 +163,7 @@ class Jeopardy(callbacks.Plugin):
if len(clue) > 1 and airdate and answer and category and not invalid and id not in self.history:
q = "{0}*({1}) [${2}] \x02{3}: {4}\x0F*{5}*{6}".format(id, airdate, points, category, clue, answer, points)
q = re.sub('<[^<]+?>', '', fix_text(q, normalization='NFKC')).encode('utf-8').decode('unicode_escape')
q = re.sub('([,;:.!?])(\w)', '\g<1> \g<2>', q)
q = " ".join(q.split())
self.questions.append(q)
n += 1
@ -170,6 +171,7 @@ class Jeopardy(callbacks.Plugin):
if len(clue) > 1 and airdate and answer and category and not invalid:
q = "{0}*({1}) [${2}] \x02{3}: {4}\x0F*{5}*{6}".format(id, airdate, points, category, clue, answer, points)
q = re.sub('<[^<]+?>', '', fix_text(q, normalization='NFKC')).encode('utf-8').decode('unicode_escape')
q = re.sub('([,;:.!?])(\w)', '\g<1> \g<2>', q)
q = " ".join(q.split())
self.questions.append(q)
n += 1
@ -226,6 +228,7 @@ class Jeopardy(callbacks.Plugin):
if len(clue) > 1 and airdate and answer and category and not invalid and id not in self.history:
q = "{0}*({1}) [${2}] \x02{3}: {4}\x0F*{5}*{6}".format(id, airdate, points, category, clue, answer, points)
q = re.sub('<[^<]+?>', '', fix_text(q, normalization='NFKC')).encode('utf-8').decode('unicode_escape')
q = re.sub('([,;:.!?])(\w)', '\g<1> \g<2>', q)
q = " ".join(q.split())
self.questions.append(q)
n += 1
@ -234,6 +237,7 @@ class Jeopardy(callbacks.Plugin):
if len(clue) > 1 and airdate and answer and category and not invalid:
q = "{0}*({1}) [${2}] \x02{3}: {4}\x0F*{5}*{6}".format(id, airdate, points, category, clue, answer, points)
q = re.sub('<[^<]+?>', '', fix_text(q, normalization='NFKC')).encode('utf-8').decode('unicode_escape')
q = re.sub('([,;:.!?])(\w)', '\g<1> \g<2>', q)
q = " ".join(q.split())
self.questions.append(q)
n += 1