关于「溯源的边界:文本长度、开放集与语体混淆」,《扶乩意动与乩文溯源》给出的定量结论是什么?

结论:第六章检验短文本与开放集:300 个字、阈值 0.45 时,名单外作者被错扣的比例降到 0.043,名单内仍有 0.940 被正确指认。

数据口径:立项蓝图把三层都写成既定事实;核对原始文献后,本书把后两层修正为有模型、待检验的假说,并说明法拉第 1853 年检验的是转桌而不是乩笔。 书中参数为示意,乩文语料全部为自拟合成示范;全部计算由书中程序生成。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.043, 0.45, 0.940, 300

texts of 300 syllables
threshold tin-list named rightD wrongly named
0.001.0001.000
0.400.9970.413
0.450.9400.043
0.500.7770.000
texts of 100 syllables
threshold tin-list named rightD wrongly named
0.000.9871.000
0.400.4100.003
0.450.2030.000
0.500.0370.000
查看完整验算程序
# Chapter 6. p62: the open-set trap and an abstention threshold
# Same seeded generator as p51. A closed-set method always names one of
# the candidates, even when the real writer, here a fourth medium D who
# is not on the list, wrote the text. Rule: name the best candidate
# only if its bigram cosine is at least t; otherwise abstain. For each t
# we report, on 300 fresh seance texts by in-list writers (A, B, C) and
# 300 by D, the share correctly named and the share of D's texts that
# are wrongly pinned on someone. Synthetic data only.
# 模型:开放集溯源与弃权阈值;语料全部为自拟合成示范。
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


SEEDS["D"] = 44
OWN["D"] = "ma che jie qiang"


def bigrams(tokens):
    return Counter(zip(tokens, tokens[1:]))


def cosine(a, b):
    keys = sorted(set(a) & set(b))
    dot = math.fsum(a[k] * b[k] for k in keys)
    na = math.sqrt(math.fsum(v * v for v in a.values()))
    nb = math.sqrt(math.fsum(v * v for v in b.values()))
    return dot / (na * nb) if na and nb else 0.0


def best(text, big):
    b = bigrams(text)
    sims = [cosine(b, big[m]) for m in "ABC"]
    top = max(sims)
    return "ABC"[sims.index(top)], top


if __name__ == "__main__":
    rng = random.Random(20261112)
    own, _, _ = corpus(rng)
    big = {m: bigrams([t for e in own[m] for t in e]) for m in "ABC"}
    for length in (300, 100):
        inset = []
        for _ in range(300):
            who = "ABC"[rng.randrange(3)]
            inset.append((who, best(write(who, length, True, rng), big)))
        outset = [best(write("D", length, True, rng), big)
                  for _ in range(300)]
        print("texts of {} syllables".format(length))
        print("  threshold t   in-list named right   D wrongly named")
        for t in (0.0, 0.40, 0.45, 0.50):
            good = len([1 for w, (n, s) in inset if s >= t and n == w])
            bad = len([1 for n, s in outset if s >= t])
            print("  {:11.2f}   {:19.3f}   {:15.3f}".format(
                t, good / 300, bad / 300))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《扶乩意动效应微肌电、乩笔轨迹随机游走与乩文语言模型溯源母典》第 6 章「溯源的边界:文本长度、开放集与语体混淆」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 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}
}

本书其他章节结论