Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
Amber | 173b4e071e | |
Amber | e293b2f456 | |
Amber | cdfcfae02d | |
Amber | d884627c51 | |
Amber | e3129b2c7c |
|
@ -11,3 +11,7 @@ __pycache__/
|
|||
.editorconfig
|
||||
.*.swp
|
||||
config.json
|
||||
config/
|
||||
data/
|
||||
config
|
||||
data
|
||||
|
|
|
@ -37,7 +37,7 @@ def make_sentence(output, cfg):
|
|||
sentence = None
|
||||
tries = 0
|
||||
while sentence is None and tries < 10:
|
||||
sentence = model.make_short_sentence(500, 200, tries=10000)
|
||||
sentence = model.make_short_sentence(500, tries=10000)
|
||||
tries = tries + 1
|
||||
|
||||
# optionally remove mentions
|
||||
|
@ -68,10 +68,10 @@ def extract_toot(toot):
|
|||
toot = html.unescape(toot) # convert HTML escape codes to text
|
||||
soup = BeautifulSoup(toot, "html.parser")
|
||||
for lb in soup.select("br"): # replace <br> with linebreak
|
||||
lb.name = "\n"
|
||||
lb.replace_with("\n")
|
||||
|
||||
for p in soup.select("p"): # ditto for <p>
|
||||
lb.name = "\n"
|
||||
p.replace_with("\n")
|
||||
|
||||
for ht in soup.select("a.hashtag"): # convert hashtags from links to text
|
||||
ht.unwrap()
|
||||
|
|
Reference in New Issue