SevdanurGenc's picture
Upload 466 files
a72d1cf verified
Raw History Blame Contribute Delete
949 Bytes
"""Ayrılmış test belgeleri için belge başına veritabanı kurar. Yalnızca süre ve tablo SAYISI yazar (içerik yazmaz)."""
import sys, time, warnings, json
warnings.filterwarnings("ignore")
sys.path.insert(0, str(__import__("pathlib").Path(__file__).resolve().parent.parent))
from pathlib import Path
from t2s.pipeline import build_database
P = Path(__file__).resolve().parent; B = P / "test_belgeler"; O = P / "db_test"; O.mkdir(exist_ok=True)
log = {}
for d in sorted(B.glob("*.pdf"), key=lambda p: p.stat().st_size):
t0 = time.time()
try:
r = build_database(O / f"{d.stem}.db", docs=[d], mode="tr")
log[d.name] = {"sn": round(time.time() - t0, 1), "tablo": len(r[0].written)}
except Exception as e:
log[d.name] = {"sn": round(time.time() - t0, 1), "hata": str(e)[:200]}
print(d.name, log[d.name], flush=True)
(O / "kurulum_gunlugu.json").write_text(json.dumps(log, ensure_ascii=False, indent=1))