mirror of
https://github.com/ioistired/pleroma-ebooks.git
synced 2024-11-20 02:14:52 +01:00
removed mentioning users at the start of a toot
This commit is contained in:
parent
9e6930ffad
commit
62e20ee6ae
13
create.py
13
create.py
@ -29,20 +29,19 @@ def make_sentence(output):
|
|||||||
os.remove("toots-copy.db")
|
os.remove("toots-copy.db")
|
||||||
|
|
||||||
sentence = None
|
sentence = None
|
||||||
while sentence is None:
|
while sentence is None or re.match("^@\u202B", sentence):
|
||||||
sentence = model.make_short_sentence(500, tries=100000)
|
sentence = model.make_short_sentence(500, tries=10000)
|
||||||
sentence = sentence.replace("\0", "\n")
|
|
||||||
output.send(sentence)
|
output.send(sentence)
|
||||||
|
|
||||||
def make_toot(force_markov = False, args = None):
|
def make_toot(force_markov = False, args = None):
|
||||||
return make_toot_markov()
|
return make_toot_markov()
|
||||||
|
|
||||||
def make_toot_markov():
|
def make_toot_markov(query = None):
|
||||||
tries = 0
|
tries = 0
|
||||||
toot = None
|
toot = None
|
||||||
while toot == None and tries < 10:
|
while toot == None and tries < 25:
|
||||||
pin, pout = multiprocessing.Pipe(False)
|
pin, pout = multiprocessing.Pipe(False)
|
||||||
p = multiprocessing.Process(target = make_sentence, args = [pout])
|
p = multiprocessing.Process(target = make_sentence, args = [pout, query])
|
||||||
p.start()
|
p.start()
|
||||||
p.join(10)
|
p.join(10)
|
||||||
if p.is_alive():
|
if p.is_alive():
|
||||||
@ -52,6 +51,8 @@ def make_toot_markov():
|
|||||||
tries = tries + 1
|
tries = tries + 1
|
||||||
else:
|
else:
|
||||||
toot = pin.recv()
|
toot = pin.recv()
|
||||||
|
if toot == None:
|
||||||
|
toot = "Mistress @lynnesbian@fedi.lynnesbian.space, I was unable to generate a toot using the markov method! This probably means that my corpus wasn't big enough... I need them to be big, Mistress, otherwise I won't work... Can you, um, help me with that, somehow?"
|
||||||
return {
|
return {
|
||||||
"toot":toot,
|
"toot":toot,
|
||||||
"media":None
|
"media":None
|
||||||
|
Loading…
Reference in New Issue
Block a user