Browse Source

Decreased the max syllables and removed some debugging code

main
Benjamin G Carlisle 5 years ago
parent
commit
da5e2bac4f
  1. 14
      shantybot.py

14
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'

Loading…
Cancel
Save