Files

25 lines
1.1 KiB
Python

"""Check a read-trans output file: python check_output.py output.md (exit 1 on failure)."""
import re, sys
text = open(sys.argv[1], encoding="utf-8").read()
low = text.lower()
fails = []
def need(ok, msg):
if not ok:
fails.append(msg)
for h in ("video enna solluthu", "medium explanation", "final takeaway", "projects-ku enna pannanum"):
need(h in low, f"missing section: {h}")
need(not re.search(r"[\u0b80-\u0bff]", text), "Tamil script found (should be Tanglish)")
need(not re.search(r"\b\d+:\d{2}\b", text), "timestamp leaked into output")
need(not re.search(r"chapter \d", low), "chapter marker leaked")
need("```" in text, "no ready-to-copy prompt block in the projects section")
need(len(re.findall(r"\b(irukku|panna|pannanum|solluthu|romba|idhu|athu|aana|illa)\b", low)) >= 8, "not enough Tanglish words")
need("subscribe" not in low, "sponsor/subscribe plug repeated")
need("$137" in text and "$22" in text, "model costs missing")
need(len(text.split()) < 700, "too long (>700 words)")
print("\n".join(["FAIL: " + f for f in fails]) or "PASS")
sys.exit(1 if fails else 0)