mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-26 04:51:09 -05:00
Jeopardy: simplify regex
This commit is contained in:
parent
02a014d968
commit
ac0512e50f
@ -276,8 +276,8 @@ class Jeopardy(callbacks.Plugin):
|
||||
def normalize(self, q):
|
||||
q = BeautifulSoup(q)
|
||||
q = fix_text(q.text).replace(r"\'", "'").replace(r'\"', '"')
|
||||
q = re.sub('([.!?])([A-Z]|\()(?![.\'])', '\g<1> \g<2>', q)
|
||||
q = re.sub('([,;:)])([a-zA-Z]|\()', '\g<1> \g<2>', q)
|
||||
q = re.sub('([.!?])([A-Z(])(?![.\'])', '\g<1> \g<2>', q)
|
||||
q = re.sub('([,;:)])([a-zA-Z(])', '\g<1> \g<2>', q)
|
||||
q = " ".join(q.split())
|
||||
return q
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user