markov: be smarter with appending punctuation
don't append commas ever (it looks weird), ignore other situations where the chain already ends with punctation so we don't need more
This commit is contained in:
@@ -25,8 +25,8 @@ def generate_line(context, topics=None, min_words=15, max_words=30, max_sentence
|
||||
if len(line) >= min_words:
|
||||
return line
|
||||
else:
|
||||
if line[-1][-1] not in [',', '.', '!']:
|
||||
line[-1] += random.choice([',', '.', '!'])
|
||||
if line[-1][-1] not in [',', '.', '!', '?', ':']:
|
||||
line[-1] += random.choice(['?', '.', '!'])
|
||||
|
||||
tries += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user