mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-26 13:01:09 -05:00
Jeopardy: better text reformatting
This commit is contained in:
parent
3ecd8a6db7
commit
02a014d968
@ -72,8 +72,6 @@ class Jeopardy(callbacks.Plugin):
|
|||||||
channel = msg.channel
|
channel = msg.channel
|
||||||
if not irc.isChannel(channel):
|
if not irc.isChannel(channel):
|
||||||
return
|
return
|
||||||
if callbacks.addressed(irc.nick, msg):
|
|
||||||
return
|
|
||||||
if self.registryValue('enabled', channel) and channel in self.games:
|
if self.registryValue('enabled', channel) and channel in self.games:
|
||||||
self.games[channel].answer(msg)
|
self.games[channel].answer(msg)
|
||||||
|
|
||||||
@ -278,7 +276,8 @@ class Jeopardy(callbacks.Plugin):
|
|||||||
def normalize(self, q):
|
def normalize(self, q):
|
||||||
q = BeautifulSoup(q)
|
q = BeautifulSoup(q)
|
||||||
q = fix_text(q.text).replace(r"\'", "'").replace(r'\"', '"')
|
q = fix_text(q.text).replace(r"\'", "'").replace(r'\"', '"')
|
||||||
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())
|
q = " ".join(q.split())
|
||||||
return q
|
return q
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user