From ccfc5e748403bcddfeddbf6acf6aa00762e1fb32 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Thu, 30 Jun 2016 22:46:47 -0500 Subject: [PATCH] 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 --- dr_botzo/markov/lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dr_botzo/markov/lib.py b/dr_botzo/markov/lib.py index e75c8da..54e767d 100644 --- a/dr_botzo/markov/lib.py +++ b/dr_botzo/markov/lib.py @@ -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