From aacd847cf9734c93084739ef45b971db22fec65f Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Thu, 16 Feb 2017 12:21:25 +0100 Subject: [PATCH] Make Markov bot unescape strings --- markov.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/markov.py b/markov.py index a6aa4e1..0d38220 100755 --- a/markov.py +++ b/markov.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import dbtools, twitools -import argparse, markovify, nltk, operator, random, re, sys +import argparse, html, markovify, nltk, operator, random, re, sys class Possy(markovify.NewlineText): def word_split(self, sentence): @@ -17,7 +17,7 @@ def getText(db = dbtools.dbHelper()): text = "" for string in db.executeQuery('SELECT text FROM tweets WHERE text NOT LIKE "@%" AND text NOT LIKE "RT %";'): text += string[0] + "\n" - return "".join([s for s in text.strip().splitlines(True) if s.strip()]) + return html.unescape("".join([s for s in text.strip().splitlines(True) if s.strip()])) def markovifyText(text): return Possy(text).make_short_sentence(130).replace("@", "@​")