What does Spirit Writing, Ideomotor Action and Text Attribution conclude, in numbers, about “Stylometric Attribution: Character-Bigram Cosine, Burrows's Delta and Naive Bayes”?
Answer: Chapter 5 demonstrates three attribution methods on a synthetic corpus, character-bigram cosine, Burrows's Delta and naive Bayes; all six revealed texts are attributed correctly, while the naive-Bayes log odds of 8.92 to 21.37 are systematically too large.
Scope of the numbers: Its parameters are illustrative and its revealed texts are synthetic demonstrations written for it; all calculations are generated by its programs. Chapter 5 demonstrates three attribution methods on a synthetic corpus, character-bigram cosine, Burrows's Delta and naive Bayes; all six revealed texts are attributed correctly, while the naive-Bayes log odds of 8.92 to 21.37 are systematically too large.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 21.37, 8.92
| log-likelihood relative to the best medium (natural log) | |||||||
| text | true | A | B | C | named | log10 odds | per 100 |
| S1 | A | 0.0 | -34.1 | -31.2 | A | 13.55 | 5.57 |
| S2 | A | 0.0 | -20.5 | -33.8 | A | 8.92 | 3.50 |
| S3 | B | -67.8 | 0.0 | -34.4 | B | 14.93 | 6.17 |
| S4 | B | -77.4 | 0.0 | -48.6 | B | 21.11 | 8.72 |
| S5 | B | -64.6 | 0.0 | -33.8 | B | 14.68 | 6.09 |
| S6 | C | -90.1 | -49.2 | 0.0 | C | 21.37 | 8.58 |
Show the full program
# Chapter 5. p53: naive Bayes on the shared syllables, Mosteller-Wallace
# style. Same seeded demonstration corpus as p51. Only the 40 shared
# syllables are features (topic words of either register are dropped,
# as Mosteller and Wallace kept to function words). Each medium gets a
# multinomial with add-one smoothing; a seance text's log-likelihood
# under each medium gives log10 odds against the runner-up and, with
# equal priors, a posterior. Independence between syllables is false
# in this corpus (habit successors), so the odds are overconfident by
# construction; the program also shows the odds per 100 syllables.
# 模型:朴素贝叶斯与对数优势比;语料全部为自拟合成示范。
import bisect
import math
import random
from collections import Counter
SYL = ("zhi hu zhe ye yi er qi suo wei yu ze nai ru ruo gu fu bu wu"
" you ren xin tian di shan shui yue ri feng yun hua men jia lu"
" chun qiu he jiang shi wen ming").split()
OWN = {"A": "cha jiu qin shu", "B": "mai dou can sang",
"C": "chuan hai qiao zhou"}
DEITY = "shen xian fo sheng dan jing tan luan".split()
SEEDS = {"A": 11, "B": 22, "C": 33}
def profile(name):
# an author's habits: a locally shuffled Zipf order of the shared
# syllables and one favourite successor for each syllable
rng = random.Random(SEEDS[name])
order = list(range(len(SYL)))
for _ in range(30):
i = rng.randrange(len(SYL) - 1)
j = min(len(SYL) - 1, i + 1 + rng.randrange(6))
order[i], order[j] = order[j], order[i]
weight = [0] * len(SYL)
for rank, idx in enumerate(order):
weight[idx] = 600 // (rank + 2)
habit = [rng.randrange(len(SYL)) for _ in SYL]
return weight, habit
def write(name, length, deity, rng):
# deity register: a shared ritual vocabulary at rate 0.2 and a
# doubled taste for the four sentence particles
weight, habit = profile(name)
if deity:
weight = [w * 2 if i < 4 else w for i, w in enumerate(weight)]
topic, rate = DEITY, 0.20
else:
topic, rate = OWN[name].split(), 0.10
cum, tot = [], 0
for w in weight:
tot += w
cum.append(tot)
out, prev = [], None
for _ in range(length):
u = rng.random()
if u < rate:
tok = topic[rng.randrange(len(topic))]
prev = None
elif prev is not None and u < rate + 0.12:
prev = habit[prev]
tok = SYL[prev]
else:
prev = bisect.bisect_right(cum, rng.randrange(tot))
tok = SYL[prev]
out.append(tok)
return out
def corpus(rng):
own = {m: [write(m, 400, False, rng) for _ in range(5)]
for m in "ABC"}
truth = "AABBBC"
revealed = [write(m, 300, True, rng) for m in truth]
return own, revealed, truth
def model(essays):
c = Counter(t for e in essays for t in e if t in SYL)
n = math.fsum(c[s] for s in SYL)
return {s: math.log((c[s] + 1) / (n + len(SYL))) for s in SYL}
def loglik(text, lp):
return math.fsum(lp[t] for t in text if t in lp)
if __name__ == "__main__":
rng = random.Random(20261112)
own, revealed, truth = corpus(rng)
lps = {m: model(own[m]) for m in "ABC"}
print("log-likelihood relative to the best medium (natural log)")
print(" text true A B C named log10 odds"
" per 100")
for i, text in enumerate(revealed):
ll = [loglik(text, lps[m]) for m in "ABC"]
top = max(ll)
best = ll.index(top)
second = sorted(ll)[-2]
lo10 = (top - second) / math.log(10.0)
used = len([t for t in text if t in lps["A"]])
print(" S{} {} {:7.1f} {:7.1f} {:7.1f} {} {:6.2f}"
" {:5.2f}".format(i + 1, truth[i], ll[0] - top,
ll[1] - top, ll[2] - top, "ABC"[best],
lo10, 100.0 * lo10 / used))Single source and citation
Fan, Y. (2026). Ideomotor Micro-Movements in Spirit Writing, Random-Walk Stylus Trajectories and Stylometric Attribution of Revealed Texts (Version 1.0.0), Chapter 5: Stylometric Attribution: Character-Bigram Cosine, Burrows's Delta and Naive Bayes. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-226 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026226,
author = {Fan, Yafu},
title = {Ideomotor Micro-Movements in Spirit Writing, Random-Walk Stylus Trajectories and Stylometric Attribution of Revealed Texts},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Ideomotor Action and Micro-EMG: Carpenter's Term and the Invisible Command
- Chapter 2 · Faraday's Indicator: the Original Evidence and Its Effect Sizes
- Chapter 3 · The Biased Random Walk of Many Small Forces: Drift, Noise and the Leading Hand
- Chapter 4 · Closed Loop and Open Loop: Why Revealed Texts Become Hard to Read under a Blindfold
- Chapter 6 · The Limits of Attribution: Text Length, Open Sets and Register Confounds
- Chapter 7 · Classics East and West: Xu Dishan's Study of Spirit Writing and Faraday's Table-Turning Experiments
- Chapter 8 · Closing the Loop: Integrity Statements for Spiritual Products, Teaching the Ideomotor Effect and Pre-Registered Tests