1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-11-25 08:38:59 +00:00

i forgot to strip mentions from the code when fake_mentions is set to never because i'm have smol bun brain please give headpat

This commit is contained in:
Lynne Megido 2019-09-19 16:17:26 +10:00
parent 8b26dfbfc0
commit 798b5a484b

View file

@ -95,14 +95,14 @@ def make_post(args):
print("No posts to learn from.") print("No posts to learn from.")
return return
model = nlt_fixed(posts)
tries = 0
post = None
if bot['fake_mentions'] == 'never': if bot['fake_mentions'] == 'never':
# remove all mentions from the training data before the markov model sees it # remove all mentions from the training data before the markov model sees it
posts = re.sub(r"(?<!\S)@\w+(@[\w.]+)?\s?", "", posts) posts = re.sub(r"(?<!\S)@\w+(@[\w.]+)?\s?", "", posts)
model = nlt_fixed(posts)
tries = 0
post = None
# even with such a high tries value for markovify, it still sometimes returns none. # even with such a high tries value for markovify, it still sometimes returns none.
# so we implement our own tries function as well, and try ten times. # so we implement our own tries function as well, and try ten times.
while post is None and tries < 10: while post is None and tries < 10: