import os, re, html
BASE = os.path.dirname(os.path.abspath(__file__))
def clean(raw):
    t = re.sub(r'<script[\s\S]*?</script>', ' ', raw)
    t = re.sub(r'<style[\s\S]*?</style>', ' ', t)
    t = re.sub(r'<[^>]+>', ' ', t)
    return html.unescape(re.sub(r'\s+', ' ', t)).strip()

for tag in ["yale-statistics", "cmu-c2ee442"]:
    raw = open(os.path.join(BASE, f'_25_{tag}.txt'), encoding='utf-8').read()
    txt = clean(raw)
    print('='*25, tag, 'len', len(txt))
    print(txt)
    print()
