Markov: properly output unicode chains

This commit is contained in:
Brian S. Stephan 2011-02-25 20:59:57 -06:00
parent 87073d7fd3
commit 7a53aaa9a1

View File

@ -250,7 +250,7 @@ class Markov(Module):
if gen_words[-1] == self.stop:
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):
"""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:
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):
"""Get the value(s) for a given key (a pair of strings)."""