re-add unidecode normalization

This commit is contained in:
Gordon Shumway 2020-02-02 07:26:21 -05:00 committed by GitHub
parent f3b1a4f479
commit 05dd821bec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -47,6 +47,7 @@ import supybot.callbacks as callbacks
import requests
import re
from ftfy import fix_text
from unidecode import unidecode
from bs4 import BeautifulSoup
import jellyfish
from supybot.i18n import PluginInternationalization, internationalizeDocstring
@ -165,8 +166,8 @@ class Jeopardy(callbacks.Plugin):
points = self.points
if len(clue) > 1 and airdate and answer and category and not invalid and id not in self.history[channel]:
q = "#{0}*({1}) [${2}] \x02{3}: {4}\x0F*{5}*{6}".format(id, airdate[0], str(points), category, clue, answer, points)
q = re.sub('<[^<]+?>', '', fix_text(q, normalization='NFKC')).encode('utf-8').decode('unicode_escape')
self.questions.append(q)
q = re.sub('<[^<]+?>', '', fix_text(q)).encode('utf-8').decode('unicode_escape')
self.questions.append(unidecode(q))
n += 1
except Exception:
continue
@ -219,8 +220,8 @@ class Jeopardy(callbacks.Plugin):
points = self.points
if len(clue) > 1 and airdate and answer and category and not invalid and id not in self.history[channel]:
q = "#{0}*({1}) [${2}] \x02{3}: {4}\x0F*{5}*{6}".format(id, airdate[0], str(points), category, clue, answer, points)
q = re.sub('<[^<]+?>', '', fix_text(q, normalization='NFKC')).encode('utf-8').decode('unicode_escape')
self.questions.append(q)
q = re.sub('<[^<]+?>', '', fix_text(q)).encode('utf-8').decode('unicode_escape')
self.questions.append(unidecode(q))
n += 1
j += 1
k += 1