# -*- 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 text(f):
    raw=open(f,encoding="utf-8",errors="replace").read()
    t=re.sub(r'<script[\s\S]*?</script>',' ',raw); t=re.sub(r'<style[\s\S]*?</style>',' ',t)
    return html.unescape(re.sub(r'\s+',' ',re.sub(r'<[^>]+>',' ',t))).strip()
for f,keys in [
 ("_27_cornell-c4ed07c.txt",["Format","Duration","credit","Degree awarded","STEM","deadline","Deadline","TOEFL","IELTS","Duolingo","GRE","GMAT","tuition","Tuition","thesis","Full-time","residential","prerequisite","bachelor"]),
 ("_27_cornell-c3b1b9a.txt",["Format","Duration","credit","Degree awarded","STEM","deadline","Deadline","TOEFL","IELTS","Duolingo","GRE","GMAT","tuition","Tuition","Full-time","residential","bachelor"]),
 ("_27_cornell-c7c652f.txt",["Format","Duration","credit","Degree Awarded","STEM","deadline","Deadline","TOEFL","IELTS","GRE","GMAT","tuition","Tuition","Full-time","in person","bachelor","Start"]),
 ("_27_uw-c2f6425.txt",["Length","Registration","Study option","deadline","TOEFL","IELTS","honours","minim","Co-op","Delivery","Program type","Admit term","bachelor"]),
]:
    t=text(f); print("\n########",f,"len",len(t))
    for k in keys:
        m=re.search(re.escape(k),t)
        if m:
            i=m.start(); print(f'  [{k}] …{t[max(0,i-55):i+125]}…')
