Markov: only add sentence punctuation if necessary
This commit is contained in:
parent
676d109f57
commit
dbc3d16f65
|
@ -158,7 +158,8 @@ def _generate_line(context, topics=None, min_words=15, max_words=30):
|
||||||
if len(line) >= min_words:
|
if len(line) >= min_words:
|
||||||
return line
|
return line
|
||||||
else:
|
else:
|
||||||
line[-1] += random.choice([',', '.', '!'])
|
if line[-1][-1] not in [',', '.', '!']:
|
||||||
|
line[-1] += random.choice([',', '.', '!'])
|
||||||
|
|
||||||
tries += 1
|
tries += 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue