Browse Source

Fixed problem with logic

main
Benjamin G Carlisle 5 years ago
parent
commit
751f351c93
  1. 8
      shantybot.py

8
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 > 10):
while first_line_rhymes_n < 4 or 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 > 10):
while second_line_rhymes_n < 4 or second_line_syllables == 0 or second_line_syllables > 10:
second_line = re.sub(r'[,;]$', '', mmodel.make_sentence(tries=10000))
@ -59,7 +59,7 @@ while len(shanty.strip().split("\n")) < 9:
third_line_syllables = 0
third_line_tries = 0
while (third_line_syllables != first_line_syllables or first_and_third_dont_rhyme) and third_line_tries < 1000:
while (third_line_syllables != first_line_syllables or first_and_third_dont_rhyme) and third_line_tries < 2000:
third_line = re.sub(r'[,;]$', '', mmodel.make_sentence(tries=10000))
@ -79,7 +79,7 @@ while len(shanty.strip().split("\n")) < 9:
fourth_line_syllables = 0
fourth_line_tries = 0
while (fourth_line_syllables != second_line_syllables or second_and_fourth_dont_rhyme) and fourth_line_tries < 1000:
while (fourth_line_syllables != second_line_syllables or second_and_fourth_dont_rhyme) and fourth_line_tries < 2000:
fourth_line = re.sub(r'[,;]$', '', mmodel.make_sentence(tries=10000))

Loading…
Cancel
Save