From da5e2bac4f1b0def72de918ad120711bae33f49d Mon Sep 17 00:00:00 2001 From: Benjamin G Carlisle Date: Fri, 5 Feb 2021 10:58:04 +0100 Subject: [PATCH] Decreased the max syllables and removed some debugging code --- shantybot.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/shantybot.py b/shantybot.py index 9ab1dd3..0cddba9 100644 --- a/shantybot.py +++ b/shantybot.py @@ -20,7 +20,7 @@ while len(shanty.strip().split("\n")) < 9: first_line_rhymes_n = 0 first_line_syllables = 0 - while first_line_rhymes_n < 4 and (first_line_syllables == 0 or first_line_syllables > 12): + while first_line_rhymes_n < 4 and (first_line_syllables == 0 or first_line_syllables > 10): first_line = re.sub(r'[,;]$', '', mmodel.make_sentence(tries=10000)) @@ -39,7 +39,7 @@ while len(shanty.strip().split("\n")) < 9: second_line_rhymes_n = 0 second_line_syllables = 0 - while second_line_rhymes_n < 4 and (second_line_syllables == 0 or second_line_syllables > 12): + while second_line_rhymes_n < 4 and (second_line_syllables == 0 or second_line_syllables > 10): second_line = re.sub(r'[,;]$', '', mmodel.make_sentence(tries=10000)) @@ -69,10 +69,6 @@ while len(shanty.strip().split("\n")) < 9: third_line_lastword = third_line_words[len(third_line_words)-1] - ## print(first_line_lastword) - ## print(third_line_lastword) - ## print() - third_line_lastword = re.sub(r'[^A-Za-z]', '', third_line_lastword) first_and_third_dont_rhyme = first_line_rhymes.count(third_line_lastword) == 0 @@ -93,10 +89,6 @@ while len(shanty.strip().split("\n")) < 9: fourth_line_lastword = fourth_line_words[len(fourth_line_words)-1] - ## print(second_line_lastword) - ## print(fourth_line_lastword) - ## print() - fourth_line_lastword = re.sub(r'[^A-Za-z]', '', fourth_line_lastword) second_and_fourth_dont_rhyme = second_line_rhymes.count(fourth_line_lastword) == 0 @@ -107,8 +99,6 @@ while len(shanty.strip().split("\n")) < 9: shanty = shanty.strip() -# print(shanty + '\n') - mastodon = Mastodon( access_token = 'shantybot_usercred.secret', api_base_url = 'https://botsin.space'