markov: don't append punctuation to nothingness
this is an attempt to fix bss/dr.botzo#10
This commit is contained in:
parent
6e21416791
commit
ed66246f14
|
@ -21,8 +21,9 @@ def generate_line(context, topics=None, min_words=15, max_words=30, sentence_bia
|
|||
if len(line) >= min_words:
|
||||
return line
|
||||
else:
|
||||
if line[-1][-1] not in [',', '.', '!', '?', ':']:
|
||||
line[-1] += random.choice(['?', '.', '!'])
|
||||
if len(line) > 0:
|
||||
if line[-1][-1] not in [',', '.', '!', '?', ':']:
|
||||
line[-1] += random.choice(['?', '.', '!'])
|
||||
|
||||
tries += 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue