tweet_generation / util.py
asahi417's picture
init
5ad627f
raw
history blame
360 Bytes
import re
URL_RE = re.compile(r"https?:\/\/[\w\.\/\?\=\d&#%_:/-]+")
HANDLE_RE = re.compile(r"@\w+")
with open("verified_users.v091122.txt") as f:
USER = set(i for i in f.read().split("\n") if len(i))
def process_url(text: str) -> str:
return URL_RE.sub("{URL}", text)
def process_username(text: str) -> str:
return HANDLE_RE.sub("[URL]", text)