# -*- coding: utf-8 -*-
import io, sys, os, re, html as htmllib
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")

# Cornell BEE 深入提取
txt=open("_43_cornell_bee.html",encoding="utf-8",errors="ignore").read()
clean=re.sub(r'<script[^>]*>.*?</script>',' ',txt,flags=re.S|re.I)
clean=re.sub(r'<style[^>]*>.*?</style>',' ',clean,flags=re.S|re.I)
clean=re.sub(r'<[^>]+>',' ',clean)
clean=htmllib.unescape(re.sub(r'\s+',' ',clean)).strip()

for kw in ["M.Eng","M.S.","PhD","Master of Engineering","Master of Science","degree","admission","application","deadline","TOEFL","IELTS","GRE","Tuition","credits","thesis","Biological","Environmental","graduate"]:
    m=re.search(r'.{0,80}'+re.escape(kw)+r'.{0,250}', clean, re.I)
    if m:
        print(f"[{kw}] {m.group(0)[:300]}")
        print()
