Markov: properly output unicode chains
This commit is contained in:
parent
87073d7fd3
commit
7a53aaa9a1
@ -250,7 +250,7 @@ class Markov(Module):
|
|||||||
if gen_words[-1] == self.stop:
|
if gen_words[-1] == self.stop:
|
||||||
gen_words = gen_words[:-1]
|
gen_words = gen_words[:-1]
|
||||||
|
|
||||||
return ' '.join(gen_words)
|
return ' '.join(gen_words).encode('utf-8', 'ignore')
|
||||||
|
|
||||||
def _reply_to_line(self, line, min_size=15, max_size=100):
|
def _reply_to_line(self, line, min_size=15, max_size=100):
|
||||||
"""Reply to a line, using some text in the line as a point in the chain."""
|
"""Reply to a line, using some text in the line as a point in the chain."""
|
||||||
@ -291,7 +291,7 @@ class Markov(Module):
|
|||||||
if gen_words[-1] == self.stop:
|
if gen_words[-1] == self.stop:
|
||||||
gen_words = gen_words[:-1]
|
gen_words = gen_words[:-1]
|
||||||
|
|
||||||
return ' '.join(gen_words)
|
return ' '.join(gen_words).encode('utf-8', 'ignore')
|
||||||
|
|
||||||
def _retrieve_chains_for_key(self, k1, k2):
|
def _retrieve_chains_for_key(self, k1, k2):
|
||||||
"""Get the value(s) for a given key (a pair of strings)."""
|
"""Get the value(s) for a given key (a pair of strings)."""
|
||||||
|
Loading…
Reference in New Issue
Block a user