feat(archive): sync dossiers 48-70, 2026-11-28 wire harvest, zoology dossiers 65-69, and lecture transcripts
This commit is contained in:
1 parent
85c5bab5e7
commit
3b5bb057ef
79 files changed
+18063
-1415
No files matched your search
@@ -23,10 +23,18 @@ def fmt_inline_safe(text: str) -> str:
|
||||
text = text.replace("σ", '<font name="Symbol">s</font>')
|
||||
text = text.replace("π", '<font name="Symbol">p</font>')
|
||||
text = (
|
||||
text.replace("⁴", "<super>4</super>")
|
||||
text.replace("⁰", "<super>0</super>")
|
||||
.replace("¹", "<super>1</super>")
|
||||
.replace("²", "<super>2</super>")
|
||||
.replace("³", "<super>3</super>")
|
||||
.replace("⁴", "<super>4</super>")
|
||||
.replace("⁵", "<super>5</super>")
|
||||
.replace("⁶", "<super>6</super>")
|
||||
.replace("⁷", "<super>7</super>")
|
||||
.replace("⁸", "<super>8</super>")
|
||||
.replace("⁹", "<super>9</super>")
|
||||
.replace("√", "sqrt")
|
||||
.replace("≈", "~")
|
||||
)
|
||||
code_spans: list[str] = []
|
||||
|
||||
|
||||
@@ -147,11 +147,14 @@ def resolve_target_dates(
|
||||
now_utc: datetime.datetime,
|
||||
explicit_date: str | None = None,
|
||||
mode: str = "auto",
|
||||
archive_dir: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
Resolve target UTC date paying strict attention to the 00:00 GMT boundary paradox.
|
||||
- At 00:00 GMT (00:00-05:59 UTC) or mode='closing-bell', target_date is (now_utc - 24h)
|
||||
because Wikipedia Portal:Current_events for the brand-new UTC day is empty at 00:00:00 GMT.
|
||||
- If archive_dir contains prior dated dossiers with a 1-day gap before yesterday_str,
|
||||
auto-selects the earliest missing recent UTC date when explicit_date is omitted.
|
||||
- In mode='live' or when now_utc.hour >= 6, target_date is now_utc.strftime('%Y-%m-%d'),
|
||||
while also retaining yesterday_utc for Wikipedia completeness.
|
||||
"""
|
||||
@@ -169,6 +172,18 @@ def resolve_target_dates(
|
||||
target_dt = yesterday_dt
|
||||
target_str = yesterday_str
|
||||
reason = "00:00_GMT_closing_bell_paradox_rule (now_utc - 24h)"
|
||||
if archive_dir and os.path.isdir(archive_dir):
|
||||
existing_dates = {
|
||||
m.group(1)
|
||||
for fn in os.listdir(archive_dir)
|
||||
if (m := re.search(r"dossier-news-(\d{4}-\d{2}-\d{2})\.md$", fn))
|
||||
}
|
||||
two_days_ago_dt = now_utc - datetime.timedelta(days=2)
|
||||
two_days_ago_str = two_days_ago_dt.strftime("%Y-%m-%d")
|
||||
if two_days_ago_str not in existing_dates:
|
||||
target_dt = two_days_ago_dt
|
||||
target_str = two_days_ago_str
|
||||
reason = "00:00_GMT_closing_bell_backfill (now_utc - 48h missing from archive)"
|
||||
else:
|
||||
target_dt = now_utc
|
||||
target_str = today_str
|
||||
@@ -420,6 +435,104 @@ def extract_candidate_entities(headlines: list[dict[str, str]]) -> list[dict[str
|
||||
return candidates[:320]
|
||||
|
||||
|
||||
_ONES = [
|
||||
"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
|
||||
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen",
|
||||
"seventeen", "eighteen", "nineteen",
|
||||
]
|
||||
_TENS = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
|
||||
_UNIT_WORDS = {
|
||||
"tn": "trillion", "trillion": "trillion",
|
||||
"bn": "billion", "b": "billion", "billion": "billion",
|
||||
"m": "million", "mn": "million", "million": "million",
|
||||
"k": "thousand", "thousand": "thousand",
|
||||
"%": "percent",
|
||||
}
|
||||
|
||||
|
||||
def _int_to_words(n: int) -> str:
|
||||
if n < 0:
|
||||
return "minus " + _int_to_words(-n)
|
||||
if n < 20:
|
||||
return _ONES[n]
|
||||
if n < 100:
|
||||
t, r = divmod(n, 10)
|
||||
return _TENS[t] + ("" if r == 0 else " " + _ONES[r])
|
||||
if n < 1000:
|
||||
h, r = divmod(n, 100)
|
||||
return _ONES[h] + " hundred" + ("" if r == 0 else " " + _int_to_words(r))
|
||||
for scale_val, scale_name in ((1_000_000_000_000, "trillion"), (1_000_000_000, "billion"), (1_000_000, "million"), (1000, "thousand")):
|
||||
if n >= scale_val:
|
||||
q, r = divmod(n, scale_val)
|
||||
return _int_to_words(q) + " " + scale_name + ("" if r == 0 else " " + _int_to_words(r))
|
||||
return str(n)
|
||||
|
||||
|
||||
def token_to_spoken_english(raw_tok: str) -> str:
|
||||
"""Convert a quantitative token like '$11B', '12,000', '$1.5tn', or '481' into spoken English words."""
|
||||
s = raw_tok.strip()
|
||||
m = re.match(r"^([$€£])?(\d[\d,]*)(?:\.(\d+))?([a-zA-Z%]+)?$", s)
|
||||
if not m:
|
||||
return s.lower()
|
||||
_curr, int_part, dec_part, unit_part = m.groups()
|
||||
int_val = int(int_part.replace(",", ""))
|
||||
words = [_int_to_words(int_val)]
|
||||
if dec_part:
|
||||
words.append("point")
|
||||
for ch in dec_part:
|
||||
words.append(_ONES[int(ch)])
|
||||
if unit_part:
|
||||
u_low = unit_part.lower()
|
||||
if u_low in _UNIT_WORDS:
|
||||
words.append(_UNIT_WORDS[u_low])
|
||||
else:
|
||||
words.append(u_low)
|
||||
return " ".join(words)
|
||||
|
||||
|
||||
def extract_quantitative_anchors(headlines: list[dict[str, str]]) -> list[dict[str, Any]]:
|
||||
"""
|
||||
Non-destructively extract quantitative/numeric tokens and their entity context into a
|
||||
parallel sidecar stream (`quantitative_anchors`), leaving `entities` 100% lexical.
|
||||
"""
|
||||
quant_items: list[dict[str, Any]] = []
|
||||
seen_pairs = set()
|
||||
quant_re = re.compile(r"(?<![a-zA-Z0-9])([$€£]?\d[\d,]*(?:\.\d+)?(?:tn|bn|mn|b|m|k|%)?)\b", re.I)
|
||||
|
||||
for idx, item in enumerate(headlines):
|
||||
hl = item["headline"]
|
||||
src = item["source"]
|
||||
story_tag = f"H{idx+1:02d}:{src}"
|
||||
# Find primary capitalized entity in the headline for context pairing
|
||||
ent_matches = [
|
||||
m.group(1).strip("'-")
|
||||
for m in re.finditer(r"\b([A-Z][a-zA-Z0-9'-]{1,}(?:\s+[A-Z][a-zA-Z0-9'-]{2,})?)\b", hl)
|
||||
if m.group(1).lower() not in {"the", "and", "for", "with", "after", "from", "into", "over", "why", "how"}
|
||||
]
|
||||
primary_entity = ent_matches[0] if ent_matches else f"H{idx+1:02d}"
|
||||
|
||||
for qm in quant_re.finditer(hl):
|
||||
q_tok = qm.group(1)
|
||||
# Skip bare calendar year 2026 unless attached to currency/unit
|
||||
if q_tok in {"2025", "2026", "2027"}:
|
||||
continue
|
||||
key = (primary_entity.lower(), q_tok.lower())
|
||||
if key in seen_pairs:
|
||||
continue
|
||||
seen_pairs.add(key)
|
||||
spoken_eng = token_to_spoken_english(q_tok)
|
||||
quant_items.append(
|
||||
{
|
||||
"story": story_tag,
|
||||
"entity_context": primary_entity,
|
||||
"q_digit": q_tok,
|
||||
"q_spoken_eng": spoken_eng,
|
||||
"headline": hl,
|
||||
}
|
||||
)
|
||||
return quant_items[:80]
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description="Pre-collect current events & Ingglish AQ matrix.")
|
||||
parser.add_argument("--date", default=None, help="Explicit YYYY-MM-DD target date override.")
|
||||
@@ -437,7 +550,7 @@ def main() -> int:
|
||||
if not os.path.exists(args.archive_dir) and os.path.exists("/workspace/ingglish-aq-archive"):
|
||||
args.archive_dir = "/workspace/ingglish-aq-archive"
|
||||
now_utc = datetime.datetime.now(datetime.timezone.utc)
|
||||
date_info = resolve_target_dates(now_utc, explicit_date=args.date, mode=args.mode)
|
||||
date_info = resolve_target_dates(now_utc, explicit_date=args.date, mode=args.mode, archive_dir=args.archive_dir)
|
||||
|
||||
# Fetch all 3 portals concurrently
|
||||
with concurrent.futures.ThreadPoolExecutor(max_workers=3) as pool:
|
||||
@@ -450,9 +563,12 @@ def main() -> int:
|
||||
|
||||
all_headlines = wiki_items + bbc_items + ap_items
|
||||
candidates = extract_candidate_entities(all_headlines)
|
||||
quant_candidates = extract_quantitative_anchors(all_headlines)
|
||||
|
||||
strings_to_translate = list(
|
||||
{h["headline"] for h in all_headlines} | {c["eng"] for c in candidates}
|
||||
{h["headline"] for h in all_headlines}
|
||||
| {c["eng"] for c in candidates}
|
||||
| {qc["q_spoken_eng"] for qc in quant_candidates}
|
||||
)
|
||||
translations = batch_translate_ingglish(strings_to_translate, workdir=args.workdir)
|
||||
|
||||
@@ -544,6 +660,26 @@ def main() -> int:
|
||||
|
||||
continuity_info = load_prior_dossiers(args.archive_dir)
|
||||
|
||||
enriched_quant_anchors = []
|
||||
for qc in quant_candidates:
|
||||
sp_eng = qc["q_spoken_eng"]
|
||||
sp_ing = translations.get(sp_eng, sp_eng.lower())
|
||||
d_aq = compute_aq(qc["q_digit"])
|
||||
s_aq = compute_aq(sp_ing)
|
||||
enriched_quant_anchors.append(
|
||||
{
|
||||
"story": qc["story"],
|
||||
"entity_context": qc["entity_context"],
|
||||
"q_digit": qc["q_digit"],
|
||||
"q_digit_aq": d_aq,
|
||||
"q_spoken_eng": sp_eng,
|
||||
"q_spoken_ing": sp_ing,
|
||||
"q_spoken_aq": s_aq,
|
||||
"spoken_prime_rank": PRIME_INDEX.get(s_aq),
|
||||
"headline": qc["headline"],
|
||||
}
|
||||
)
|
||||
|
||||
payload = {
|
||||
"temporal_metadata": date_info,
|
||||
"continuity": continuity_info,
|
||||
@@ -553,6 +689,7 @@ def main() -> int:
|
||||
"ap_headlines": len(ap_items),
|
||||
"total_headlines": len(enriched_headlines),
|
||||
"candidate_entities": len(enriched_entities),
|
||||
"quantitative_anchors": len(enriched_quant_anchors),
|
||||
"twin_prime_headlines": len(twin_prime_headlines),
|
||||
"cross_story_collision_classes": len(cross_story_collisions),
|
||||
"isometric_locks": len(isometric_locks),
|
||||
@@ -561,6 +698,7 @@ def main() -> int:
|
||||
"shared_prime_attractors": shared_prime_attractors,
|
||||
"cross_story_collisions": cross_story_collisions,
|
||||
"isometric_locks": isometric_locks,
|
||||
"quantitative_anchors": enriched_quant_anchors,
|
||||
"headlines": enriched_headlines,
|
||||
"entities": enriched_entities,
|
||||
}
|
||||
|
||||
@@ -273,7 +273,15 @@ def render_md_and_pdf(rows, out_md: str, out_pdf: str):
|
||||
doc.build(story, onFirstPage=add_page_number, onLaterPages=add_page_number)
|
||||
|
||||
|
||||
def render_png(rows, out_png: str):
|
||||
def render_png(
|
||||
rows,
|
||||
out_png: str,
|
||||
header_title: str = "INGGLISH AQ ARCHIVE — MASTER BIDIRECTIONAL EVALUATION TIER LIST (S+ TO F)",
|
||||
header_subtitle: str | None = None,
|
||||
footer_text: str | None = None,
|
||||
write_atomic: bool = True,
|
||||
custom_tier_defs: list | None = None,
|
||||
):
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
FONT_BOLD = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf"
|
||||
@@ -294,7 +302,7 @@ def render_png(rows, out_png: str):
|
||||
f_empty_bold = ImageFont.truetype(FONT_BOLD, 18)
|
||||
f_footer = ImageFont.truetype(FONT_REG, 15)
|
||||
|
||||
tier_defs = [
|
||||
default_tier_defs = [
|
||||
("S+", "95 – 100 pts", "APEX LOCK", "#FF4D4D", "0 Dossiers in Tier S+", ""),
|
||||
("S", "90 – 94 pts", "CANONICAL", "#FF7F7F", "0 Dossiers in Tier S", ""),
|
||||
("A", "81 – 89 pts [3⁴]", "STRUCTURAL", "#FFBF7F", "0 Dossiers in Tier A", ""),
|
||||
@@ -324,6 +332,7 @@ def render_png(rows, out_png: str):
|
||||
"Rejected by Post-Write Arithmetic Audit (100% of archive equations verified exact with 0 sum mismatches).",
|
||||
),
|
||||
]
|
||||
tier_defs = [tuple(t) for t in custom_tier_defs] if custom_tier_defs else default_tier_defs
|
||||
|
||||
W = 1960
|
||||
MARGIN_X = 28
|
||||
@@ -360,13 +369,18 @@ def render_png(rows, out_png: str):
|
||||
draw.line([(0, HEADER_H - 8), (W, HEADER_H - 8)], fill="#333640", width=2)
|
||||
draw.text(
|
||||
(MARGIN_X, 22),
|
||||
"INGGLISH AQ ARCHIVE — MASTER BIDIRECTIONAL EVALUATION TIER LIST (S+ TO F)",
|
||||
header_title,
|
||||
fill="#F5F6F8",
|
||||
font=f_title,
|
||||
)
|
||||
sub_str = (
|
||||
header_subtitle
|
||||
if header_subtitle
|
||||
else f"All {len(rows)} Dossiers ({tot_eqs} Verified Equations) | Graded on Option #4: Hybrid Numogrammatic Curve (Class S >= 90, Class A >= 81 [3⁴], Class B >= 72, C/D/F < 72)"
|
||||
)
|
||||
draw.text(
|
||||
(MARGIN_X, 68),
|
||||
f"All {len(rows)} Dossiers ({tot_eqs} Verified Equations) | Graded on Option #4: Hybrid Numogrammatic Curve (Class S >= 90, Class A >= 81 [3⁴], Class B >= 72, C/D/F < 72)",
|
||||
sub_str,
|
||||
fill="#A5AAB5",
|
||||
font=f_subtitle,
|
||||
)
|
||||
@@ -415,46 +429,86 @@ def render_png(rows, out_png: str):
|
||||
draw.rounded_rectangle([cx0 + 12, cy0 + 14, cx0 + 60, cy0 + 40], radius=5, fill="#15171C", outline=bg, width=1)
|
||||
draw_centered((cx0 + 12, cy0 + 14, cx0 + 60, cy0 + 40), c["rank"], f_card_rank, bg)
|
||||
|
||||
score_txt = f"{c['curve_score']}/100 (Raw {c['raw_score']})"
|
||||
score_txt = c.get("score_badge_text") or f"{c['curve_score']}/100 (Raw {c['raw_score']})"
|
||||
sb_w = 158
|
||||
draw.rounded_rectangle([cx1 - sb_w - 12, cy0 + 14, cx1 - 12, cy0 + 40], radius=5, fill="#15171C", outline="#454A59", width=1)
|
||||
draw_centered((cx1 - sb_w - 12, cy0 + 14, cx1 - 12, cy0 + 40), score_txt, f_card_rank, "#F0F2F5")
|
||||
|
||||
codes = f"Eval {c['eval_num']} • Dossier {c['dossier_num']}"
|
||||
draw.text((cx0 + 70, cy0 + 19), codes, fill="#9DA3B4", font=f_card_dossier)
|
||||
codes = c.get("badge_code") or f"Eval {c['eval_num']} • Dossier {c['dossier_num']}"
|
||||
draw.text((cx0 + 70, cy0 + 19), codes[:22], fill="#9DA3B4", font=f_card_dossier)
|
||||
draw.text((cx0 + 14, cy0 + 47), c["title"], fill="#FFFFFF", font=f_card_title)
|
||||
draw.line([(cx0 + 14, cy0 + 74), (cx1 - 14, cy0 + 74)], fill="#363A47", width=1)
|
||||
|
||||
draw.text((cx0 + 14, cy0 + 80), "• " + c["lock1"], fill="#FFD97D", font=f_card_lock)
|
||||
draw.text((cx0 + 14, cy0 + 99), "• " + c["lock2"], fill="#A8E6CF", font=f_card_lock)
|
||||
|
||||
stats = f"IsoW: {c['iso_w_pct']:.1f}% | PrimeW: {c['prime_ing_pct']:.1f}% | Mean|Δ|: {c['mean_delta']:.1f} | Pad: {c['pad_pct']:.1f}%"
|
||||
stats = c.get("stat_bar_text") or f"IsoW: {c['iso_w_pct']:.1f}% | PrimeW: {c['prime_ing_pct']:.1f}% | Mean|Δ|: {c['mean_delta']:.1f} | Pad: {c['pad_pct']:.1f}%"
|
||||
draw.rounded_rectangle([cx0 + 10, cy1 - 32, cx1 - 10, cy1 - 8], radius=4, fill="#1A1C23")
|
||||
draw.text((cx0 + 16, cy1 - 28), stats, fill="#CED3E0", font=f_card_stat)
|
||||
|
||||
cur_y += th + ROW_GAP
|
||||
|
||||
fy = H - FOOTER_H + 16
|
||||
foot_str = (
|
||||
footer_text
|
||||
if footer_text
|
||||
else "Rubric Dimensions (20 pts each): D1 = CMUdict Purity & Mean Clause Drift | D2 = Independent Domain-Native Collision Density | D3 = Repdigit & Prime Word Architecture (+Rarity Bonus) | D4 = Epistemological Fit | D5 = Anti-Padding Rate"
|
||||
)
|
||||
draw.text(
|
||||
(MARGIN_X, fy),
|
||||
"Rubric Dimensions (20 pts each): D1 = CMUdict Purity & Mean Clause Drift | D2 = Independent Domain-Native Collision Density | D3 = Repdigit & Prime Word Architecture (+Rarity Bonus) | D4 = Epistemological Fit | D5 = Anti-Padding Rate",
|
||||
foot_str,
|
||||
fill="#8C92A4",
|
||||
font=f_footer,
|
||||
)
|
||||
img.save(out_png, "PNG", optimize=True)
|
||||
if write_atomic:
|
||||
tmp_png = out_png + ".tmp"
|
||||
img.save(tmp_png, "PNG", optimize=True)
|
||||
os.replace(tmp_png, out_png)
|
||||
else:
|
||||
img.save(out_png, "PNG", optimize=True)
|
||||
|
||||
|
||||
def main():
|
||||
import json
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--archive-dir", default="/workspace/ingglish-hyperdope-gematria/ingglish-aq-archive")
|
||||
ap.add_argument("--rows-json", default=None, help="Optional pre-computed cohort JSON (e.g. Assemblage Builds from technocapital-singularity-zoology).")
|
||||
ap.add_argument("--header-title", default="INGGLISH AQ ARCHIVE — MASTER BIDIRECTIONAL EVALUATION TIER LIST (S+ TO F)")
|
||||
ap.add_argument("--header-subtitle", default=None)
|
||||
ap.add_argument("--footer-text", default=None)
|
||||
ap.add_argument("--skip-md", action="store_true", help="When --rows-json already generated custom Markdown, only compile PDF and PNG.")
|
||||
ap.add_argument("--out-md", default="/workspace/ingglish-hyperdope-gematria/dossier-bidirectional-eval-tier-list.md")
|
||||
ap.add_argument("--out-pdf", default="/workspace/ingglish-hyperdope-gematria/dossier-bidirectional-eval-tier-list.pdf")
|
||||
ap.add_argument("--out-png", default="/workspace/ingglish-hyperdope-gematria/dossier-bidirectional-eval-tier-list.png")
|
||||
args = ap.parse_args()
|
||||
|
||||
rows = collect_evaluations(args.archive_dir)
|
||||
render_md_and_pdf(rows, args.out_md, args.out_pdf)
|
||||
render_png(rows, args.out_png)
|
||||
if args.rows_json:
|
||||
with open(args.rows_json, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
rows = data["rows"] if isinstance(data, dict) and "rows" in data else data
|
||||
custom_tier_defs = data.get("tier_defs") if isinstance(data, dict) else None
|
||||
if not args.skip_md:
|
||||
render_md_and_pdf(rows, args.out_md, args.out_pdf)
|
||||
elif args.out_pdf and args.out_md and os.path.exists(args.out_md):
|
||||
# Compile PDF from existing custom Markdown via build_wire_report_pdf.py
|
||||
import subprocess, sys
|
||||
build_script = os.path.join(os.path.dirname(__file__), "build_wire_report_pdf.py")
|
||||
subprocess.run(
|
||||
[sys.executable, build_script, "--md", args.out_md, "--pdf", args.out_pdf, "--title", args.header_title],
|
||||
check=True,
|
||||
)
|
||||
render_png(
|
||||
rows,
|
||||
args.out_png,
|
||||
header_title=args.header_title,
|
||||
header_subtitle=args.header_subtitle,
|
||||
footer_text=args.footer_text,
|
||||
custom_tier_defs=custom_tier_defs,
|
||||
)
|
||||
else:
|
||||
rows = collect_evaluations(args.archive_dir)
|
||||
render_md_and_pdf(rows, args.out_md, args.out_pdf)
|
||||
render_png(rows, args.out_png)
|
||||
print(f"Ranked {len(rows)} evaluations -> {args.out_md}, {args.out_pdf}, {args.out_png}")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user