diff --git a/scripts/classify_technocapital_singularity.py b/scripts/classify_technocapital_singularity.py index 420c8d5..83c7fd2 100755 --- a/scripts/classify_technocapital_singularity.py +++ b/scripts/classify_technocapital_singularity.py @@ -569,6 +569,7 @@ def revise_economic_anchor( "entity": target_anchor["entity"], "metric": target_anchor["metric"], "source_dossier": target_anchor["source_dossier"], + "quant_free_lexical_equations": target_anchor.get("quant_free_lexical_equations", []), "path_c_dual_mode_comparison": { "digit_mode": { "q_old": old_digit, @@ -615,9 +616,190 @@ DEFAULT_CORPUS = [ ] +_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: + import re + 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 scan_harvest_for_revisions( + harvest_path: str, + anchors_path: str, + base_report: dict[str, Any], + quant_mode: str = "dual", + workdir: str = "/workspace/ingglish-hyperdope-gematria", +) -> dict[str, Any]: + """ + Non-destructively scan a `news-aq-harvest-*.json` file: + - If `quant_mode == 'off'`, returns only the pure lexical classification of the harvest's `entities`. + - Otherwise, extracts quantitative figures from `quantitative_anchors` (or directly from `headlines` + if `quantitative_anchors` is absent in older harvest files), compares them against tracked + entities in `quantitative-economic-anchors.json`, and automatically fires `revise_economic_anchor()` + whenever a figure has mutated. + """ + import re + harvest = json.loads(Path(harvest_path).read_text(encoding="utf-8")) + anchors_data = json.loads(Path(anchors_path).read_text(encoding="utf-8")) + tracked_anchors = anchors_data.get("anchors", []) + + if quant_mode == "off": + return { + "quant_mode": "off", + "note": "Quantitative stream disabled (--quant-mode off); returning pure lexical entity classification only.", + "lexical_entity_count": len(harvest.get("entities", [])), + } + + quant_items = harvest.get("quantitative_anchors") + if quant_items is None: + quant_items = [] + quant_re = re.compile(r"(? int: + import re ap = argparse.ArgumentParser(description="Identify, taxonomize, and revise Landian-Deleuzean technocapital singularities (S1-S6).") ap.add_argument("--terms", nargs="*", help="Custom list of terms to analyze (defaults to canonical S1-S6 corpus).") + ap.add_argument( + "--quant-mode", + choices=["off", "spoken", "digit", "dual"], + default="off", + help="Tri-modal quantitative handling: 'off' (default pure lexical), 'spoken' (numbers translated to Ingglish words), 'digit' (literal 0-9), 'dual' (both).", + ) ap.add_argument("--workdir", default="/workspace/ingglish-hyperdope-gematria", help="Path to repo containing node_modules/ingglish.") ap.add_argument( "--anchors-file", @@ -630,11 +812,37 @@ def main() -> int: metavar=("ANCHOR_ID", "NEW_DIGIT", "NEW_SPOKEN_ENG"), help="Evaluate a quantitative economic anchor revision and surface alternative 333/666/777 equations.", ) + ap.add_argument( + "--scan-harvest", + default=None, + help="Optional path to news-aq-harvest-latest.json to scan for quantitative revisions and new S1-S6 anchors.", + ) ap.add_argument("--out", default=None, help="Optional JSON output file path.") args = ap.parse_args() - terms = args.terms if args.terms else DEFAULT_CORPUS - report = analyze_terms(terms, workdir=args.workdir) + raw_terms = args.terms if args.terms else DEFAULT_CORPUS + processed_terms = [] + for t in raw_terms: + if args.quant_mode == "off": + # Strip full quantitative tokens (including attached units like $6B, $1.5tn, 481) in pure lexical mode + clean_t = re.sub(r"(? int: workdir=args.workdir, ) out_str = json.dumps(rev_report, indent=2, ensure_ascii=False) + elif args.scan_harvest: + eff_mode = "dual" if args.quant_mode == "off" else args.quant_mode + scan_res = scan_harvest_for_revisions( + harvest_path=args.scan_harvest, + anchors_path=args.anchors_file, + base_report=report, + quant_mode=eff_mode, + workdir=args.workdir, + ) + out_str = json.dumps(scan_res, indent=2, ensure_ascii=False) else: out_str = json.dumps(report, indent=2, ensure_ascii=False) diff --git a/taxonomy/quantitative-economic-anchors.json b/taxonomy/quantitative-economic-anchors.json index 2cae943..65c3875 100644 --- a/taxonomy/quantitative-economic-anchors.json +++ b/taxonomy/quantitative-economic-anchors.json @@ -1,14 +1,27 @@ { - "version": "1.2.0", + "version": "1.3.0", "anchors": [ { "anchor_id": "lazarus_heist_6b", "entity": "Lazarus / Binance Crypto Heist", + "entity_match_keywords": ["lazarus", "binance", "north korea"], "metric": "stolen_capital_haul", "q_digit": "$6B", "q_spoken_eng": "six billion", "q_spoken_ing": "siks bilyan", "source_dossier": "25-dossier-news-2026-11-01.md", + "quant_free_lexical_equations": [ + { + "target": 333, + "ing": "lazeras loks lejer", + "eng": "Lazarus locks ledger" + }, + { + "target": 666, + "ing": "wor masheen hohldz dha kohld asml in gpu", + "eng": "war machine holds the cold ASML in GPU" + } + ], "baseline_equations": [ { "target": 333, @@ -41,11 +54,24 @@ { "anchor_id": "anthropic_ipo_price_83", "entity": "Anthropic IPO Share Price", + "entity_match_keywords": ["anthropic", "amodei", "claude"], "metric": "ipo_share_price_usd", "q_digit": "$83", "q_spoken_eng": "eighty three", "q_spoken_ing": "aytee three", "source_dossier": "55-dossier-news-2026-11-18.md", + "quant_free_lexical_equations": [ + { + "target": 333, + "ing": "klawd hohldz reeman", + "eng": "Claude holds Riemann" + }, + { + "target": 666, + "ing": "daireeoh amodai hits dha anthropik at dha ai", + "eng": "Dario Amodei hits the Anthropic at the AI" + } + ], "baseline_equations": [ { "target": 333, @@ -79,11 +105,24 @@ { "anchor_id": "bangladesh_factories_481", "entity": "Bangladesh Minimum-Wage Garment Strike", + "entity_match_keywords": ["bangladesh", "garment", "factories"], "metric": "halted_factories_count", "q_digit": "481", "q_spoken_eng": "four hundred eighty one", "q_spoken_ing": "for huhndrad aytee wuhn", "source_dossier": "62-dossier-news-2026-11-24.md", + "quant_free_lexical_equations": [ + { + "target": 333, + "ing": "kapatal hohldz aset", + "eng": "capital holds asset" + }, + { + "target": 777, + "ing": "lajistiks hohldz dha noo kapatal in deep signal", + "eng": "logistics holds the new capital in deep signal" + } + ], "baseline_equations": [ { "target": 777,