# -*- coding: utf-8 -*-
import sys, io, re, pathlib, html as H
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
CACHE = pathlib.Path(r"D:\work buddy\2026-11-05-14-15-52\cache")

def txt(x):
    x = re.sub(r"<script.*?</script>", " ", x, flags=re.S)
    x = re.sub(r"<[^>]+>", " ", x)
    return re.sub(r"\s+", " ", H.unescape(x)).strip()

raw = (CACHE / "gt-lang.html").read_text(encoding="utf-8", errors="ignore")
t = txt(raw)
for kw in ["IELTS", "Duolingo", "79", "90", "6.5", "7.0", "105", "120"]:
    idx = [m.start() for m in re.finditer(re.escape(kw), t)]
    print(kw, len(idx), [t[max(0, i-80):i+80] for i in idx[:2]])
