# -*- 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))
cbe=clean("_17_cbe.txt")
i=cbe.find("Master of Science Candidates")
print("[CBE MS]",cbe[i:i+520])
i=cbe.find("Master of Engineering Candidates")
print("\n[CBE MEng]",cbe[i:i+420])
ece=clean("_17_ece.txt")
for kw in ["research focus","Research","nanotechn","signal","robotics","computer architecture","control","energy","biomedical"]:
    m=re.search(re.escape(kw),ece,re.I)
    if m:
        s=max(0,m.start()-50); e=min(len(ece),m.end()+170); print(f"\n[ECE {kw}] {ece[s:e]}")
