Make Markov bot unescape strings
This commit is contained in:
parent
3cafac4649
commit
aacd847cf9
1 changed files with 2 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import dbtools, twitools
|
import dbtools, twitools
|
||||||
import argparse, markovify, nltk, operator, random, re, sys
|
import argparse, html, markovify, nltk, operator, random, re, sys
|
||||||
|
|
||||||
class Possy(markovify.NewlineText):
|
class Possy(markovify.NewlineText):
|
||||||
def word_split(self, sentence):
|
def word_split(self, sentence):
|
||||||
|
@ -17,7 +17,7 @@ def getText(db = dbtools.dbHelper()):
|
||||||
text = ""
|
text = ""
|
||||||
for string in db.executeQuery('SELECT text FROM tweets WHERE text NOT LIKE "@%" AND text NOT LIKE "RT %";'):
|
for string in db.executeQuery('SELECT text FROM tweets WHERE text NOT LIKE "@%" AND text NOT LIKE "RT %";'):
|
||||||
text += string[0] + "\n"
|
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):
|
def markovifyText(text):
|
||||||
return Possy(text).make_short_sentence(130).replace("@", "@")
|
return Possy(text).make_short_sentence(130).replace("@", "@")
|
||||||
|
|
Loading…
Reference in a new issue