# -*- coding: utf-8 -*-
import io, sys, re
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")

def show(fn, kws, start=1500, width=300):
    t = open(fn, encoding="utf-8").read()
    print("########", fn, "len", len(t))
    for kw in kws:
        i = t.lower().find(kw.lower(), start)
        if i > 0:
            print(f"\n[{kw}] ...{t[max(0,i-150):i+width]}...")
        else:
            print(f"\n[{kw}] NOT FOUND")

show("_cornell_aero_admit.txt",
     ["TOEFL", "IELTS", "subscore", "transcript", "GPA", "score", "waive", "English"],
     start=5000)

show("_cornell_aero_degree.txt",
     ["credit", "Capstone", "Project", "elective", "concentration", "focus", "30", "course", "seminar", "MEng"],
     start=5000)
