Files
sim-numerics/apply_table9b_narrow.py

28 lines
1.9 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Table 9b fits a page: the three seen corpora new-1, Roots.jl and applied stay in the six-corpus
total (their columns are quoted nowhere in the text); the numbers themselves are unchanged and
still checked row by row by verify_controls().
python -u apply_table9b_narrow.py
"""
PATH = "article/sim_numerics.md"
OLD = """| detector | APS | CHA | new-1 | Roots.jl | applied | corpus 4 | all | A′ on corpus 4 |
|---|---|---|---|---|---|---|---|---|
| **analogy (A′)** | 2259 | **1074** | **3290** | **1371** | **1382** | **3656** | **13032** | — |
| Lagouanelle, with memory | **2235** | 1437 | 4026 | 1495 | 1490 | 4488 | 15171 | 84/121/35, $p=8\\cdot10^{-6}$ |
| Chandrupatla's band | 2682 | 2526 | 5485 | 2117 | 1622 | 6236 | 20668 | 110/96/34, $p=1.5\\cdot10^{-10}$ |
| none | 2693 | 2526 | 5569 | 2126 | 1670 | 6165 | 20749 | 113/87/40, $p=3\\cdot10^{-9}$ |"""
NEW = """| detector | APS | CHA | corpus 4 | six corpora | A′ on corpus 4 | $p$ |
|---|---|---|---|---|---|---|
| **analogy (A′)** | 2259 | **1074** | **3656** | **13032** | — | |
| Lagouanelle, with memory | **2235** | 1437 | 4488 | 15171 | 84/121/35 | $8\\cdot10^{-6}$ |
| Chandrupatla's band | 2682 | 2526 | 6236 | 20668 | 110/96/34 | $1.5\\cdot10^{-10}$ |
| none | 2693 | 2526 | 6165 | 20749 | 113/87/40 | $3\\cdot10^{-9}$ |"""
src = open(PATH, encoding="utf8").read()
assert src.count(OLD) == 1, src.count(OLD)
src = src.replace(OLD, NEW)
src2 = src.replace("**Table 9b.** A′ against its detector swapped: totals on the six corpora of §9 (uniform criterion), and A′'s wins/ties/losses on corpus 4. No variant breaks the bound.",
"**Table 9b.** A′ against its detector swapped: totals on the two canonical sets, on corpus 4 and over the six corpora of §9 (uniform criterion), and A′'s wins/ties/losses on corpus 4 with the exact sign test. No variant breaks the bound.")
assert src2 != src
open(PATH, "w", encoding="utf8").write(src2)
print("Table 9b narrowed")