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 ["wustl-stats","rice-macc","mit-mban"]:
    raw=open(os.path.join(BASE,f'_25_{tag}.txt'),encoding='utf-8').read()
    txt=clean(raw)
    print('='*25,tag,'len',len(txt))
    for kw in ['PhD','doctoral','Master of Account','MAcc','graduate','undergraduate','online','part-time','full-time','residency','Deadline','deadline','TOEFL','IELTS','GRE','GMAT','tuition','credit','units','STEM','track','concentration','eligib']:
        i=txt.lower().find(kw.lower())
        if i>=0:
            print(f'  [{kw}] ...{txt[max(0,i-70):i+170]}...')
    print()
