mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 22:24:20 +01:00
Updated jeffk.
This commit is contained in:
parent
e12f69b7a2
commit
112303af56
@ -109,7 +109,7 @@ example = utils.wrapLines("""
|
|||||||
<supybot> I have 24941 objects: 234 modules, 716 classes, 5489 functions, 1656 dictionaries, 827 lists, and 14874 tuples (and a few other different types). I have a total of 119242 references.
|
<supybot> I have 24941 objects: 234 modules, 716 classes, 5489 functions, 1656 dictionaries, 827 lists, and 14874 tuples (and a few other different types). I have a total of 119242 references.
|
||||||
<jemfinch> @levenshtein supybot supbot
|
<jemfinch> @levenshtein supybot supbot
|
||||||
<supybot> 1
|
<supybot> 1
|
||||||
<jemfinch> (taht's the edit distance between "supybot" and "supbot")
|
<jemfinch> (that's the edit distance between "supybot" and "supbot")
|
||||||
<jemfinch> @soundex jemfinch
|
<jemfinch> @soundex jemfinch
|
||||||
<supybot> J515
|
<supybot> J515
|
||||||
<jemfinch> @soundex supercallifragilisticexpealadocious
|
<jemfinch> @soundex supercallifragilisticexpealadocious
|
||||||
@ -587,7 +587,7 @@ class Fun(callbacks.Privmsg):
|
|||||||
def randomlyReplace(s, probability=0.5):
|
def randomlyReplace(s, probability=0.5):
|
||||||
def f(m):
|
def f(m):
|
||||||
if random.random() < probability:
|
if random.random() < probability:
|
||||||
return s
|
return m.expand(s)
|
||||||
else:
|
else:
|
||||||
return m.group(0)
|
return m.group(0)
|
||||||
return f
|
return f
|
||||||
@ -606,21 +606,61 @@ class Fun(callbacks.Privmsg):
|
|||||||
random.shuffle(L)
|
random.shuffle(L)
|
||||||
return ''.join(L)
|
return ''.join(L)
|
||||||
text = privmsgs.getArgs(args)
|
text = privmsgs.getArgs(args)
|
||||||
text = re.sub(r'er\b', 'ar', text)
|
|
||||||
text = re.sub(r'\bthe\b', 'teh', text)
|
alwaysInsertions = {
|
||||||
text = re.sub(r'you', 'yuo', text)
|
r'er\b': 'ar',
|
||||||
text = re.sub(r'\bis\b', 'si', text)
|
r'\bthe\b': 'teh',
|
||||||
text = re.sub(r'ing\b', 'eing', text)
|
r'\byou\b': 'yuo',
|
||||||
text = re.sub(r'like', 'liek', text)
|
r'\bis\b': 'si',
|
||||||
text = re.sub(r'y\b', randomlyReplace('ey', 0.9), text)
|
r'\blike\b': 'liek',
|
||||||
|
r'[^e]ing\b': 'eing',
|
||||||
|
}
|
||||||
|
for (r, s) in alwaysInsertions.iteritems():
|
||||||
|
text = re.sub(r, s, text)
|
||||||
|
|
||||||
|
randomInsertions = {
|
||||||
|
r'i': 'ui',
|
||||||
|
r'le\b': 'al',
|
||||||
|
r'i': 'io',
|
||||||
|
r'l': 'll',
|
||||||
|
r'to': 'too',
|
||||||
|
r'that': 'taht',
|
||||||
|
r'[^s]c([ei])': r'sci\1',
|
||||||
|
r'ed\b': r'e',
|
||||||
|
r'\band\b': 'adn',
|
||||||
|
r'\bhere\b': 'hear',
|
||||||
|
r'\bthey\'re': 'their',
|
||||||
|
r'\bthere\b': 'they\'re',
|
||||||
|
r'\btheir\b': 'there',
|
||||||
|
r'[^e]y': 'ey',
|
||||||
|
}
|
||||||
|
for (r, s) in randomInsertions.iteritems():
|
||||||
|
text = re.sub(r, randomlyReplace(s), text)
|
||||||
|
|
||||||
text = re.sub(r'(\w)\'(\w)', quoteOrNothing, text)
|
text = re.sub(r'(\w)\'(\w)', quoteOrNothing, text)
|
||||||
text = re.sub(r'\.(\s+|$)', randomExclaims, text)
|
text = re.sub(r'\.(\s+|$)', randomExclaims, text)
|
||||||
text = re.sub(r'([aeiou])([aeiou])', randomlyShuffle, text)
|
text = re.sub(r'([aeiou])([aeiou])', randomlyShuffle, text)
|
||||||
text = re.sub(r'to', randomlyReplace('too', 0.6), text)
|
|
||||||
text = re.sub(r'([bcdfghkjlmnpqrstvwxyz])([bcdfghkjlmnpqrstvwxyz])',
|
text = re.sub(r'([bcdfghkjlmnpqrstvwxyz])([bcdfghkjlmnpqrstvwxyz])',
|
||||||
lessRandomlyShuffle, text)
|
lessRandomlyShuffle, text)
|
||||||
|
|
||||||
|
if random.random() < .3:
|
||||||
|
if random.random() < .5:
|
||||||
|
insult = random.choice([' fagot1', ' fagorts', ' jerks',
|
||||||
|
'fagot'
|
||||||
|
' jerk', ' dumbshoes', ' dumbshoe'])
|
||||||
|
else:
|
||||||
|
insult = ''
|
||||||
|
laugh1 = random.choice(['ha', 'hah', 'lol', 'l0l', 'ahh'])
|
||||||
|
laugh2 = random.choice(['ha', 'hah', 'lol', 'l0l', 'ahh'])
|
||||||
|
laugh1 = laugh1 * random.randrange(1, 5)
|
||||||
|
laugh2 = laugh2 * random.randrange(1, 5)
|
||||||
|
exclaim = random.choice(['!', '~', '!~', '~!!~~', '!!~', '~~~!'])*2
|
||||||
|
laugh = ''.join([' ', laugh1, laugh2, insult, exclaim])
|
||||||
|
text += laugh
|
||||||
|
|
||||||
if random.random() < .4:
|
if random.random() < .4:
|
||||||
text = text.upper()
|
text = text.upper()
|
||||||
|
|
||||||
irc.reply(msg, text)
|
irc.reply(msg, text)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user