shuffle(usable_selections)
return usable_selections[0][select_length]
- def purge_undesired(tokens):
- for token in tokens:
- if None != re.match("^" + URLREGEX, token):
- del(tokens[tokens.index(token)])
+ def malkovich_undesired(tokens):
+ #for token in tokens:
+ # if None != re.match("^" + URLREGEX, token):
+ # del(tokens[tokens.index(token)])
for name in session.uses_in_chan:
while True:
try:
- del(tokens[tokens.index(name)])
+ tokens[tokens.index(name.lower())] = "malkovich"
except ValueError:
break
return tokens
file.close()
tokens = []
for line in lines:
- line = line.replace("\n", "")
+ line = line.replace("\n", "").lower()
tokens += line.split()
- tokens = purge_undesired(tokens)
+ tokens = malkovich_undesired(tokens)
if len(tokens) <= select_length:
notice("NOT ENOUGH TEXT TO MARKOV.")
return
for i in range(select_length - 1):
snippet[i] = snippet[i + 1]
snippet[select_length - 1] = new_end
- notice(msg.lower() + "malkovich.")
+ notice(msg + "malkovich.")
if "addquote" == command:
addquote()