What does Code-Switching Thresholds and Monolingual Precision conclude, in numbers, about “Field Tools and Checker Specifications: the Insertion Ledger, Four-Kit Checkers and a Pre-registered Test”?
Answer: Chapter 8 gives the insertion ledger, checker specifications for four kits, the distilled Code-Switching Net-Gain and Monolingual-Equivalence Calculator and a pre-registered test. Parameters are illustrative and all calculations are generated by the book's programs; nothing corresponds to a real customer, conversation or sale, and Malay, Hokkien, Cantonese, English and Mandarin are treated as equals. This is not linguistic doctrine and not business advice to any individual or company. Marked boxes separate published evidence, runnable Python calculations (23 programs), classical sources and the author's hypotheses.
Scope of the numbers: Parameters are illustrative and all calculations are generated by the book's programs; nothing corresponds to a real customer, conversation or sale, and Malay, Hokkien, Cantonese, English and Mandarin are treated as equals. This is not linguistic doctrine and not business advice to any individual or company.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python only
| id | word | p | p* | d | d_max | cov | trans | verdict |
|---|---|---|---|---|---|---|---|---|
| L1 | kiasu | 0.82 | 0.844 | 0.8 | 2.62 | 0.8 | 9.5 | AMBER PSTAR |
| D2 | lepak | ? | 0.967 | 1.6 | - | 0.8 | 7.0 | RED UNK |
| C3 | paiseh | 0.95 | 0.933 | 0.4 | 5.10 | 1.0 | 6.0 | GREEN |
| B4 | sajiao | 0.10 | 0.858 | 0.3 | 0.00 | 0.8 | 4.0 | AMBER PSTAR,DENS |
| L5 | shiok | 0.90 | - | 2.5 | 4.02 | 0.6 | 8.0 | RED COV,NEG |
| C6 | followup 0.97 | 0.935 | 3.5 | 5.56 | 1.0 | 21.0 | RED TRS | |
| D7 | kiasu | 0.95 | 0.844 | 0.5 | 5.10 | 0.8 | 5.0 | RED LINE |
| tally: RED 4, AMBER 2, GREEN 1 |
Show the full program
# Chapter 8. p81: the insertion ledger, seven synthetic rows, one verdict.
# Per row: coverage p (None when unknown), insertions per 100 chars d,
# bits saved for knowers G (p31), failure cost F = Le + K (p41),
# coverage of the monolingual rewrite, translationese per 1,000 chars,
# and whether the copy trips a red line. Rules (sources in brackets):
# red p unknown and d > 1.0 [ch5]; rewrite coverage < 0.8 [ch6];
# translationese > 18.44 [ch6]; copy red line [ch8]
# amber p < p* = F / (G + F) [ch4]; G <= 0 [ch3]; d > d_max(p) [ch5]
# Rows are synthetic and describe no real customer or message.
import math
A, B, C = 3.0, 0.15, 6.0
ROWS = [
("L1", "kiasu", 0.82, 0.8, 7.22, 38.97, 0.8, 9.5, False),
("D2", "lepak", None, 1.6, 1.33, 38.55, 0.8, 7.0, False),
("C3", "paiseh", 0.95, 0.4, 2.70, 37.55, 1.0, 6.0, False),
("B4", "sajiao", 0.10, 0.3, 6.82, 41.29, 0.8, 4.0, False),
("L5", "shiok", 0.90, 2.5, -3.80, 39.14, 0.6, 8.0, False),
("C6", "followup", 0.97, 3.5, 2.10, 30.00, 1.0, 21.0, False),
("D7", "kiasu", 0.95, 0.5, 7.22, 38.97, 0.8, 5.0, True),
]
def d_max(p):
u = lambda d: A * math.log1p(d) - B * d * d - C * (1 - p) * d
if A - C * (1 - p) <= 0:
return 0.0
lo, hi = 1e-9, 40.0
for _ in range(200):
mid = (lo + hi) / 2
if u(mid) > 0:
lo = mid
else:
hi = mid
return lo
def verdict(row):
_, _, p, d, g, f, cov, tr, line = row
red, amber = [], []
if p is None and d > 1.0:
red.append("UNK")
if cov < 0.8:
red.append("COV")
if tr > 18.44:
red.append("TRS")
if line:
red.append("LINE")
pstar = f / (g + f) if g > 0 else None
if g <= 0:
amber.append("NEG")
elif p is not None and p < pstar:
amber.append("PSTAR")
if p is not None and d > d_max(p):
amber.append("DENS")
level = "RED" if red else ("AMBER" if amber else "GREEN")
return level, pstar, red + amber
if __name__ == "__main__":
print("id word p p* d d_max cov trans verdict")
tally = {}
for r in ROWS:
level, pstar, why = verdict(r)
tally[level] = tally.get(level, 0) + 1
ps = " - " if pstar is None else "{:.3f}".format(pstar)
pp = " ? " if r[2] is None else "{:.2f} ".format(r[2])
dm = " - " if r[2] is None else "{:5.2f}".format(d_max(r[2]))
tag = (level + " " + ",".join(why)).strip()
print("{:<3} {:<8} {} {} {:>4.1f} {} {:>4.1f} {:>5.1f} {}"
.format(r[0], r[1], pp, ps, r[3], dm, r[6], r[7], tag))
print("tally: " + ", ".join("{} {}".format(k, tally[k])
for k in ("RED", "AMBER", "GREEN")
if k in tally))Single source and citation
Fan, Y. (2026). Information Theory of Code-Switching, Lexical-Gap Compensation and Monolingual Precision Equivalence in Multilingual Markets (Version 1.0.0), Chapter 8: Field Tools and Checker Specifications: the Insertion Ledger, Four-Kit Checkers and a Pre-registered Test. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-381 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026381,
author = {Fan, Yafu},
title = {Information Theory of Code-Switching, Lexical-Gap Compensation and Monolingual Precision Equivalence in Multilingual Markets},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Not Laziness: Switch Points Obey Two Grammars
- Chapter 2 · The Information at a Switch Point: Surprisal, Word Length and Uniform Density
- Chapter 3 · The Bit Ledger and the Degree of a Lexical Gap
- Chapter 4 · The Audience-Coverage Threshold: When an Inserted Word Becomes a Decoding Failure
- Chapter 5 · An Upper Bound on Insertion Density, and the Register Signal
- Chapter 6 · Monolingual Constructional Equivalence: Precision Without Insertion
- Chapter 7 · Classical Sources: Yan Fu's Three Difficulties, Confucius on Names, Jerome's Sense for Sense and Schleiermacher's Two Paths