# -*- coding: utf-8 -*-
import io, sys, os, re, html
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
def clean(fn):
    raw=open(fn,"rb").read().decode("utf-8","ignore")
    raw=html.unescape(re.sub(r"<script.*?</script>","",raw,flags=re.S)); raw=html.unescape(re.sub(r"<style.*?</style>","",raw,flags=re.S))
    t=re.sub(r"<[^>]+>"," ",raw); return html.unescape(re.sub(r"\s+"," ",t))
files={"Biochem-MHS":"_21_c1b6b67.txt","Biostat-MHS":"_21_c6cfbd0.txt","Biostat-ScM":"_21_c682af5.txt","GlobHealthEcon":"_21_cb5871a.txt","HEOR":"_21_c42b996.txt","HFM":"_21_cab39af.txt"}
for k,fn in files.items():
    t=clean(fn)
    print("="*22,k,"len",len(t))
    for kw in ["Master of","MHS","ScM","credits","credit","full-time","full time","part-time","part time","online","evening","weekend","thesis","capstone","residential","admission","Research","Track"]:
        m=re.search(re.escape(kw),t,re.I)
        if m:
            s=max(0,m.start()-40); e=min(len(t),m.end()+150); print(f"[{kw}] …{t[s:e]}\n")
