# Mathematical methods

Definitions, defaults and implementation limits of Lixity's measurements for
manuscript revision and exploratory linguistic text analysis. Start with the
[linguistic workflow](USAGE.md#linguistic-text-analysis) to preserve inputs,
settings and outputs for reproducible work.
Research context and known limitations live in
[`STABILITY.md`](STABILITY.md); command flags live in [`USAGE.md`](USAGE.md).

Review thresholds are configurable heuristics, not universal laws. Read their
active values from passport `meta`; formula constants and estimator conventions
are separate from author preferences.

The earlier 1.25 corrections changed measurements and derived results.
Passport schema 5 also changes the ordered-baseline diagnostics described below.
Regenerate chapter
metrics, style passports and reports before comparing outputs from before the
prose-scope, MTLD, robust-scale, segmentation, distribution and dimension
corrections. A source update alone does not refresh stored outputs.

## 1. Robust house-style baseline

The reference population is the supplied manuscript's measurable chapters.
Retained research sources, including travel accounts and monographs, are not
added to that population. Source analysis uses the same engine on one archived
source version and labels its interpretation `source_internal`; an explicit
source–manuscript comparison produces a separate report, not a new baseline.

### Language and presentation boundary

Language selection changes tokenization, linguistic feature extraction and
the readability model. It does not translate or alter the definitions of
median/MAD, FDR correction or eigendecomposition. JSON numbers remain numeric;
locale-specific decimal separators are applied only when rendering reports.
See [LOCALIZATION.md](LOCALIZATION.md) for supported profiles and limitations.

Token, syllable, dialogue and sentence measures share the supported prose scope:
body paragraphs, list items and blockquote paragraphs with `>` delimiters
removed. YAML front matter, code, headings, comments and footnote definitions
are omitted; inline emphasis and footnote anchors are stripped. Sentence
boundaries never cross a blank line: each semantic block is split on its own,
and a block without terminal punctuation stays one fragment unit. This bounded
Markdown policy is not a complete CommonMark parser. Visible prose beneath a
leading document title (`# …`) before the first chapter contributes to global
metrics but not chapter-only reports.
When no document title precedes the chapters, opening prose is measured as
part of the opening chapter. Sentence punctuation and soft wraps help
distinguish prose from a bare title line, which retains its title role.
Paragraph profiles intentionally cover body paragraphs and list items only,
retaining their source line anchors; they omit blockquotes.

The global function-word share is `100 × matching function-word tokens / all
counted tokens` in that same corpus prose scope. Its overview tile uses the
corpus measurement, rather than an unweighted mean of paragraph percentages.
The `CorpusMetrics.function_word_pct` field is `null` when the language profile
has no function-word list, the corpus has no counted tokens, or an older payload
omits the field. The UI reports the missing measurement explicitly.

Configured `word_regex` flags are respected across analysis surfaces; cue
patterns retain their separate case-insensitive contract. The cue pattern
selects the hits and the word pattern supplies the density denominator. A word
pattern may have zero capturing groups (each whole match is a token) or one (its capture
is the token). Multiple capturing groups are rejected with a configuration
error; use noncapturing `(?:...)` groups for additional regex structure.
English and German
default word patterns include Unicode accented letters. LF and CRLF share
semantic paragraph boundaries. Short-paragraph counting uses paragraph
whitespace words and the inclusive configured threshold, including eight-word
paragraphs. Legacy whitespace counts remain distinct from regex token counts.

**Since v0.7.6:** the shared Markdown counting projection uses Unicode NFC for
token, vocabulary, cue and syllable measurements. Configured word/cue patterns
operate on that canonical counting text; their flags are unchanged. Document
boundary patterns and appendix markers still address the original source. Manuscript
bytes, displayed quotations, line anchors and source hashes are not normalized.
Appendix examples inside fenced code or within a longer HTML comment leave
the following prose in scope. A whole comment configured as the marker can
still end the analysis.
Literal evidence maps complete canonical clusters back to original codepoint
ranges; ambiguous inner-cluster cuts retain counts with unavailable mapping.
Legacy raw/clean character counts still describe original codepoints, not
grapheme clusters. This is canonical equivalence, not general linguistic word
segmentation; see [Unicode UAX #29](https://www.unicode.org/reports/tr29/).

Sentence-length measurements apply the word pattern to each recognized sentence
and average the resulting nonempty lengths. Paragraph totals apply the pattern
to the paragraph. Boundary-sensitive custom patterns can yield different totals
at those scopes.

The global UI word count uses the corpus token measurement, matching its sentence
and ASL values. Paragraph/chapter profile views remain narrower: pre-chapter
prose and blockquotes can contribute to corpus counts without paragraph profiles.
The two scope explanations are separate; a missing profile is not missing prose.

v0.7.2 corrects internal straight (`'`) and curly (`’`) apostrophes in the French,
Spanish, Italian, Portuguese and Dutch default word patterns. These orthographic
tokens follow the existing profile convention, not grammatical clitic analysis.
First-person starter matching (`first_person_start_rate` in `analyzer.py`)
extracts each sentence's first `word_regex` token match (lowercased; sentences
without a word-token match are excluded from the denominator), checks both the
full token and its pre-apostrophe stem (`first.replace("’", "'").split("'", 1)[0]`,
e.g. `j'aime -> j`, `i'm -> i`) against the language profile's
`first_person_starters`, and reports `100 × matching_sentences / token_bearing_sentences`
(`0.0` when no sentence contains a word token, or for `generic` which has an
empty starter set). Sentence-start Shannon entropy (`start_entropy`) retains the
exact unstemmed lowercased starter frequencies over the same denominator.
Recompute affected token counts, derived measurements and first-person start
rates before comparing older outputs.

Chapter labels remain available for navigation; changing a title does not
change its prose readability. For even sentence counts, `median_sl_exact`
averages the two middle lengths. The older integer `median_sl` retains its upper
middle value for JSON compatibility; reports use the exact median.

Corpus `dialog_words` and chapter dialogue counts use the configured
`word_regex`, as do their denominators (`tokens` and chapter `words`). Thus
`dialog_ratio` and chapter `dialog_pct` count the same token unit inside and
outside detected quotations. The legacy whitespace count `clean_words` is
unchanged and is not the dialogue-ratio denominator. Recompute older dialogue
reports and dependent style results before comparing across this correction.

The manuscript reader shows the recognized words and the paragraph word count.
A paragraph containing just one marked reply can contribute all of its words.
Chapter bars use the chapter's full analyzed word count to show how much of its
prose falls within recognized marks.

### Perception/filter word cues

Density features (`filter_density`, modal, passive, nominalisation) are counts
over the whole prose scope including detected quotations: a perception verb in
direct speech contributes like one in the narrating voice. The reports do not
attribute speakers. Treat a high density together with the chapter's
`dialog_pct` — a value carried by dialogue is characterisation, not narration.
A narrative-only variant of these densities is a documented candidate for a
future schema, not part of the current contract.

Since v0.7.2 the German cue list includes the indicative present and simple-past
forms of **hören** and **riechen**, alongside the existing listed forms. Their
spellings follow Duden's [hören](https://www.duden.de/konjugation/hoeren) and
[riechen](https://www.duden.de/konjugation/riechen) tables. This is a bounded lexical
extension, not a lemmatizer or a test of narrative distance. For example, a room
that *riecht nach Farbe* contributes a match even without a perceiving narrator;
a somatic description without a listed verb can contribute none. Compounds,
all tenses, subjunctives and participles are not exhaustively covered; ambiguous
*gehört* is not added as a standalone cue. Project `filter_verbs_regex` replaces
the list, including an explicitly empty pattern. Zero means no listed matches,
not an ideal style. Regenerate German filter densities and dependent comparisons
before comparing reports across this change.

### Dimension cutoffs and robust baselines

The 3D dashboard displays up to three derived dimension scores. A point is
flagged when a completed dimension score reaches the configured absolute
cutoff on any displayed axis. All feature contributions must be summed before
testing that cutoff: intermediate partial sums are not dimension scores.
The visual boundary is therefore a box of per-axis cutoffs, not a sphere or
a joint confidence region. Camera rotation and zoom do not change scores.

Per feature $f$ over $n$ measurable chapters with values $x_1,\dots,x_n$:

| Quantity | Definition | Notes |
| :--- | :--- | :--- |
| Centre | $\tilde{x} = \mathrm{median}(x_i)$ | robust to single outliers; `huber_location()` provides an IRLS Huber M-estimator ($k=1.345$, MAD scale) |
| Spread | $\mathrm{MAD} = \mathrm{median}(\lvert x_i - \tilde{x}\rvert)$ | 0 for $n < 2$; `split_mad()` gives asymmetric lower/upper $\sigma_{\mathrm{MAD}}$ around the median |
| Sigma | $\sigma = 1.4826 \cdot \mathrm{MAD}$ | rounded normal-consistency factor $1/\Phi^{-1}(0.75)$; `mad_finite_sample_factor(n)` provides Croux & Rousseeuw (1992) small-sample $b_n$ |
| Skew & fences | $\mathrm{MC} \in [-1, 1]$ (`medcouple()`) | Brys et al. (2004) non-parametric skewness; `adjusted_boxplot_fences()` uses Hubert & Vandervieren (2008) fences ($Q_1 - 1.5 e^{-4\mathrm{MC}}\mathrm{IQR}$, $Q_3 + 1.5 e^{3\mathrm{MC}}\mathrm{IQR}$ for $\mathrm{MC} \ge 0$, swapped exponents for $\mathrm{MC} < 0$) |

The shared median sorts once and retains the ordinary midpoint arithmetic. If
two finite middle values overflow their floating sum, the midpoint uses the
standard library's exact-ratio mean instead. The shared mean applies the same
fallback only when a finite input sequence overflows its ordinary sum; this
also preserves cancellation residuals that could disappear if each observation
were scaled first. MAD reuses the shared median. Ordinary finite rounding,
signed-zero and empty-input conventions are unchanged; this is not a claim of
exact arithmetic throughout every downstream statistic.

A standardized chapter–feature comparison requires at least
`FingerprintThresholds.min_chapters` observations and a nonzero scale $\sigma$.
When `MAD = 0` on a varying series, `StyleFingerprint` falls back to
`sn_estimator()` and then `qn_estimator()`; only if both are non-positive or
non-finite is the series marked `zero_mad_varying`. Schema 5 marks insufficient
references and both constant and remaining zero-MAD series explicitly,
excluding those cells from $z^*$, nominal FDR and consistency. Raw values and
separately calculated Cliff's delta remain available where supported. Ranked
dimensions and structural measurements can still use varying zero-MAD series.
In `StyleFingerprint.passport()`, non-negative features (`NON_NEGATIVE_FEATURES`)
clamp their lower reference band $\tilde{x} - 2\sigma$ at `0.0`.

Text passports show unavailable reference bands and their reason. JSON uses
`null` for the band when MAD is zero and for median, sigma and band when there
are too few observations. The legacy numeric consistency sentinel is qualified
by `measured_cells` and is not a measurement when that count is zero.

## 2. Noise-adjusted deviation (z*)

Plain robust z:

$$
z_{\text{raw}} = \frac{1}{1.4826} \cdot \frac{x - \tilde{x}}{\mathrm{MAD}}
\quad (0.6745 \approx 1/1.4826\text{; implemented as the exact inverse})
$$

Lixity combines the descriptive manuscript spread with an estimated measurement
error:

$$
z^* = \frac{x - \tilde{x}}{\sqrt{\sigma_{\mathrm{MAD}}^2 + \mathrm{SE}^2}}
$$

Standard errors per feature (plug-in estimators, fixed constants, see
`style_se` in the analyze schema):

| Feature family | Estimator |
| :--- | :--- |
| Count densities (per 1 000 words) | Continuity-adjusted Poisson (`poisson_se_per_mille`): $\mathrm{SE} = 1000\sqrt{k_{\mathrm{eff}}}/W$, where $k_{\mathrm{eff}} = 0.5$ when $k = 0$ and $W > 0$, else $\max(k, 0)$ |
| Shares (%) | Jeffreys continuity-adjusted binomial (`binomial_se_percent`): $\mathrm{SE} = 100\sqrt{p_{\mathrm{eff}}(1-p_{\mathrm{eff}})/N}$ percentage points, using $p_{\mathrm{eff}} = 0.5/(N+1)$ when $p \le 0$ and $(N+0.5)/(N+1)$ when $p \ge 1$ |
| ASL | Sample-SD standard error of the mean: $\mathrm{SE} = \sigma_s/\sqrt{N_s - 1} = s/\sqrt{N_s}$ for $N_s > 1$ (0 for $N_s \le 1$), where $\sigma_s^2 = \sum_i (l_i-\bar l)^2/N_s$ |
| Sentence-length CV | delta method: $\mathrm{SE} = \frac{\mathrm{CV}}{\sqrt{2N_s}}\sqrt{1+2\,\mathrm{CV}^2}$ |
| Start entropy | plug-in variance $(H_2 - H^2)/N$ with $H_2=\sum p\log_2^2 p$; negative values clamp to 0 |
| Guiraud R | relative-error approximation $\mathrm{SE} = 0.5\,R/\sqrt{N}$ over $N$ content tokens |

Larger standard errors reduce the magnitude of $z^*$, limiting noise-driven
flags. Exact HD-D has no independent window-sampling SE: its `style_se` entry
is omitted. The fingerprint's missing-SE fallback of zero denotes no estimated
measurement SE for this feature, **not** certainty about a larger population.
These plug-ins do not establish independence of words/sentences or calibrated
null probabilities for chapter features. Zero observed events can give zero
plug-in error without establishing population certainty.

The ASL standard error uses the conventional sample-SD denominator
($\mathrm{SE} = \sigma_s/\sqrt{N_s - 1} = s/\sqrt{N_s}$) for $N_s > 1$, avoiding
the slight downward bias of the $N_s$ divisor on short chapters. An empty or
one-sentence unit currently has zero plug-in error, not evidence of certainty.
Jeffreys continuity adjustments on binomial shares and `count = 0.5` on
zero-hit Poisson densities prevent `SE = 0.0` collapse on zero-hit or 100%-hit
chapters without establishing population certainty. The manuscript's sentences
are not an IID sample; neither estimator alone establishes a confidence interval
for narrative style.

The $z^*$ denominator is evaluated with a scaled Euclidean norm (`math.hypot`)
to avoid overflow and underflow from squaring extreme finite spread/SE values.
Finite operands whose difference overflows are divided before subtraction;
overflowing or subnormal spread/SE norms are evaluated in normalized units.
The raw robust score also preserves the scale factor when its intermediate
numerator is subnormal.
The binomial SE calculation retains the small Jeffreys tail at both percentage
endpoints and keeps the count divisor outside the square root of the
endpoint adjustment. Scaled ratios, including Poisson standard errors, use
exact division when an intermediate quotient or a count conversion would
lose a representable result.
This preserves the formula and zero-spread rule; it does not calibrate the
underlying normal-tail probabilities.

Since v0.7.2, the library's `StyleFingerprint.from_metrics` boundary rejects
non-finite numeric feature values and supplied standard errors that are
nonnumeric, boolean, negative or non-finite, naming the chapter and feature in a
`ValueError`. Validation precedes comparability floors. A `None` feature remains
unavailable; an absent or `None` standard error keeps the documented zero
fallback. Invalid measurements do not become measured zero deviations.

### Comparability floors

Local minimum sizes keep tiny samples out of comparisons. They are policies,
not reliability guarantees; below a floor the affected value is unavailable
(a dash in the dashboard, `null` in JSON) and is excluded from medians, MAD,
dimensions and FDR calculations.

| Floor | Value | Applies to |
| :--- | :--- | :--- |
| Words per chapter | `MIN_COMPARABLE_WORDS` = 100 (the `MIN_TOKENS_LD` diversity floor) | every per-chapter feature comparison in the style fingerprint: z*, effect sizes, FDR sets and the reference baseline; showing/telling z-scores, means and rankings. Chapters below it keep their word counts in the matrix but receive no comparison values. Scenes stay descriptive: they show measured values with standard errors, and HD-D remains unavailable below the same word count. |
| Sentences | `MIN_COMPARABLE_SENTENCES` = 5 | sentence-distribution features: staccato share, cascade share, sentence-length CV, start entropy and first-person starts; shares, variance and entropy from fewer sentences are bound to the sample size. The sentence-length mean (`asl`) stays measurable above the word floor. |
| Sentences for variation (scenes) | 2 | scene-table sentence CV; a single-sentence unit has no variation. |

## 3. Thresholds (`FingerprintThresholds`)

| Key | Default | Meaning |
| :--- | :--- | :--- |
| `z_mild` | 2.5 | notable deviation: enters `deviations`, drives expected FP count |
| `z_strong` | 3.5 | strong deviation (reported, not a second cut on `deviations`) |
| `fdr_q` | 0.05 | nominal selection level; prose FDR is not established |
| `fdr_method` | `bh` | BH or BY step-up rule; both require valid input null probabilities |
| `min_chapters` | 2 | below this, no baseline for a feature |
| `dim_score_threshold` | 2.5 | \|dimension score\| from here: chapter flagged on that axis |
| `flag_min_severity` | 2 | paragraph severity floor for the flags panel (1–3) |

- A cell counts **in band** iff |z\*| < `z_mild`.
- `expected_false_positives` = m · P(|Z| ≥ z_mild) with
  m = measured cells and P the two-sided normal tail (`erfc`). At the
  default 2.5 this is ≈ 1.24 % of $m$ under a standard-normal null. It is
  a model reference, not a measured count of false findings in the manuscript.
- Injectability: CLI `--preset {balanced,developmental,line_editing,conservative_by}`
  (on `analyze`, `profile`, `style`, `dashboard`, `pdf`, `build`) and explicit
  `--z-mild/--z-strong/--fdr-q/--fdr-method/--dim-threshold/--flag-min-severity`
  overrides on `style`, `dashboard`, `build`; API kwargs of the same names (plus
  `CorpusConfig.apply_preset()`); the
  control-server settings form applies `z_mild`, `z_strong`, `fdr_q`,
  `flag_min_severity`, `dim_score_threshold` to the current server session.
  It preserves the existing `fdr_method`; configure that through the CLI,
  Python API or project configuration. Explicit-project operations read only
  the selected root's `lixity.toml` or `[tool.lixity]` in `pyproject.toml`;
  CLI/API overrides and native session settings are separate invocation contexts.
  See [configuration precedence](USAGE.md#configuration-corpusconfig) for the
  explicit-file lookup and the optional project save.
- Every passport reports the **active** values under `meta.*` — never
  re-hardcode the defaults.

## 4. Multiple testing (Benjamini–Hochberg / Benjamini–Yekutieli)

Input: one $p$-value per measured cell, $p = P(\lvert Z \rvert \ge \lvert z^* \rvert)$
(two-sided normal tail). Sort ascending, find the largest $k$ with
$p_{(k)} \le (k/m) \cdot q / c$, reject $p_{(1)},\dots,p_{(k)}$.
Deterministic tie-break by $(\text{chapter}, \text{feature})$. The rejected
set is `fdr_flagged`. This records selection under the implemented model,
not confirmed errors or validated statistical significance in prose.

**Since v0.5.0:** chapters explicitly assigned through
`chapter_registers` retain their measured values, z-scores and membership in
the manuscript baseline, but are excluded from `deviations` and the FDR input
family. Here $m$ is the number of eligible cells after that exclusion.
`measured_cells`, descriptive consistency and the nominal
`expected_false_positives` reference still count all measured cells. Author
`register_profiles` ranges produce separate `register_targets` comparisons;
they supply neither a sampling distribution nor statistical significance.
See [Chapter register settings](USAGE.md#chapter-register-settings).

- **BH** ($c = 1$): controls FDR for valid null probabilities under
  independence or the specified positive-dependence conditions.
- **BY** ($c = \sum_{i=1}^{m} 1/i$): accommodates arbitrary dependence
  between valid null probabilities. It does not repair invalid probabilities.

Lixity estimates its median/MAD from the same chapters it scores and then
applies a normal tail to the custom $z^*$. That calibration has not been
established. Runs/lag diagnostics and switching to BY do not establish it.

<a id="decision-legend-and-small-chapter-sets-unreleased"></a>

### Decision legend and small chapter sets

The reference panel, text passport and additive
`passport.meta.interpretation` contract (`style-interpretation/1`) distinguish:

| Output | Rule and reference | Interpretation |
| --- | --- | --- |
| Passport band | Median ± 2σ of usable chapter values, no chapter SE; nonnegative JSON bounds are clipped at zero | Descriptive spread, not a confidence interval |
| `deviations` | \|z*\| ≥ active `z_mild`, including the available chapter SE | Descriptive chapter contrast |
| `consistency` | Share of measurable cells with \|z*\| < `z_mild` | Not the share within the ±2σ band and not a quality score |
| `fdr_flagged` | Nominal BH/BY selection of standard-normal tails of same-sample z* | Model selection; calibrated error control is not established |
| `expected_false_positives` | Measured-cell count × standard-normal tail at `z_mild` | Model reference expectation, not an observed or calibrated false-positive count |
| Paragraph layer | \|z\| ≥ 1.5 against eligible paragraphs within each chapter, after rounding z to two decimals | Separate population and cutoff; not chapter FDR |
| Projection flags | Absolute unrounded rank-axis score ≥ active `dim_score_threshold` | Descriptive coordinate cutoff, not a probability |

Register-assigned chapters remain in the manuscript reference and consistency
ratio but are excluded from deviation/FDR shortlists; the contract lists them
in `register_excluded_chapters`.

These rules intentionally remain distinct. Changing a label or raising a minimum
sample count cannot supply their missing statistical calibration.

For two distinct usable chapter values, exact-arithmetic median/MAD gives
σ = 1.4826 · |x₁−x₂| / 2. Thus \|z*\| ≤ 1/1.4826 ≈ 0.67449076;
nonnegative SE can only decrease the magnitude. z* cells are still calculated,
but the default cutoff 2.5 cannot be reached. The contract identifies such
features individually in `two_chapter_features` and
`unreachable_deviation_features`; unavailable/constant features are not included.
Floating-point midpoint rounding can violate that ideal bound: `[1.0,
math.nextafter(1.0, 2.0)]` rounds its median to an endpoint and can produce an
implemented magnitude near 1.34898. The contract labels the ideal bound's
`two_chapter_bound_assumption` as `exact_arithmetic`, additionally computes
`two_chapter_abs_z_star_upper_bounds` with zero SE in the implemented coordinates,
and guards unreachable-cutoff claims against these numerical bounds.
`two_chapter_rounding_sensitive_features` identifies material disagreement
(relative tolerance 1e-12); UI/text report the comparison as rounding-sensitive.
The underlying z*/selection algorithm is not silently changed.

A configured cutoff at or below this bound is not declared unreachable, although
SE can still prevent an actual flag. The minimum of two is a computational
availability policy, not an inferential reliability guarantee.

There is no corresponding universal MAD ceiling at three, four or five values:
`[0, 1, M]`, for example, has median 1 and MAD 1 for sufficiently large M,
so its largest unadjusted score grows with M. No normal-tail calibration is
inferred from these examples. Permuting chapter labels alone preserves the
unordered values and their same-sample outlier scores; it does not calibrate
this selection procedure.

A candidate to evaluate is a conditional test of a **complete null** for
additive features, initially long-word share. Divide prose into nonoverlapping
blocks and specify strata before looking at contrasts. Blocks within a stratum
must be jointly exchangeable across their chapter slots under the null, for
example in synthetic corpora generated with equally long blocks of the same
register. Permute whole blocks only among slots with the same stratum and token
count, keeping chapter positions, chapter sizes and within-block dependence.
Recompute a prespecified statistic such as the maximum absolute studentized
chapter contrast against the pooled share. Keep ties in the upper tail and
enumerate small assignment spaces. For $B$ independent uniform draws from the
permutation group, use $(1 + \#\{T_b \ge T_\mathrm{obs}\})/(B+1)$.
[Hemerik and Goeman (2018)](https://pmc.ncbi.nlm.nih.gov/articles/PMC6405018/).

Before using such a test, specify the inference target, eligible features,
block construction, nuisance strata and minimum attainable tail probability.
At a nominal 5% rejection threshold, for example, 9,999 draws yield 0.0001
tail-probability resolution and about 0.0022 Monte Carlo standard error near
5%. Enumerate toy cases to check ties and tail probabilities. Use at least
10,000 independently generated corpora per validation scenario if the target
is about half a percentage point of 95% binomial precision near 5%. Report
empirical rejection rates with intervals, power against prespecified shifts,
and the proportion of cases too sparse to test. Include short and uneven
chapters, ties, shared feature dependence, missing measurements, and ordered
drift or cross-block serial dependence as assumption-violation stress tests.
A complete-null maximum test addresses the rate of any false rejection under
that null. Cell-level FDR or strong family-wise control would require their
own justification and validation under partial nulls.
[Rempala and Yang (2013)](https://pmc.ncbi.nlm.nih.gov/articles/PMC3873102/).

## 4a. Effect sizes (magnitude, not just significance)

For every FDR-selected cell, passport `effect_magnitudes` carries a band label
derived from Cliff's $\delta$, using Romano et al.'s bands. The implied
Vargha–Delaney $\hat{A}_{12} = (\delta + 1)/2$ restates the same contrast;
neither numerical value is emitted in that field:

| $\lvert\delta\rvert$ | Label |
| :--- | :--- |
| < 0.147 | negligible |
| < 0.33 | small |
| < 0.474 | medium |
| ≥ 0.474 | large |

Sign: positive = the chapter exceeds more other chapters than it falls below;
ties contribute zero. The bands describe ordinal contrast, not literary merit.

<a id="4b-exchangeability-diagnostics-baseline-quality"></a>
## 4b. Exploratory chapter-order indicators

Schema 5 replaces schema 4's `exchangeable`, `mean_lag1_rho`, `acf_critical`
and global `low_power` fields. They could imply a positive result without any
measurements and opposite feature correlations could cancel. Each entry in
`baseline_diagnostics.features` instead records `observed_chapters` and
`missing_chapters`, plus `runs_z`, `lag1_rho` and `lag1_critical` as numbers or
null. A feature with no observations has no entry. A missing chapter makes its
order statistics unavailable: observations on either side are not treated as
adjacent. A constant series or fewer than three chapters has no lag statistic;
the runs statistic additionally requires at least eight chapters.

For a complete measured series, `lag1_flagged` uses the local descriptive
cutoff $|\rho_1| \ge 1/\sqrt{n}$, with that feature's own $n$;
`runs_flagged` uses $|z| \ge 1.96$. `measured_features` counts features with
at least one available statistic. These cutoffs are exploratory heuristics,
not validated tests for literary chapter series. For example, the conventional
normal approximation for the runs test has stronger sample requirements
([NIST](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35d.htm)).
Neither a flag nor its absence establishes exchangeability, independence,
calibrated probabilities or an artistic judgment.

## 4c. Structural diagnostics (`structural_diagnostics`)

Pure-stdlib structural and distributional diagnostics over the ordered
per-feature series (chapters in order) plus token-level lexical diagnostics
when the passport is built from source text (`api.fingerprint`, `lixity style`,
`lixity build`, `lixity dashboard`). They add exploratory ordered-series and
lexical contrasts alongside the per-cell z\*/FDR layer; calculation and model
limits are listed below.

| Key | Estimator | Guard / notes |
| :--- | :--- | :--- |
| `changepoints` | exact unpruned dynamic programming on global-SD-standardized series for guarded cost $n\ln\max(\sigma^2, 10^{-9})$ and mBIC-inspired default penalty $3\ln n$ | singleton segment cost is zero before the penalty. Longer segments use the variance floor, including flat segments. Anchored centred moments use $O(n^2)$ time and $O(n)$ storage. Features with missing chapters or $n<3$ appear in `segmentation_unavailable`. Complete series use 0-based indices of the first chapter after a break |
| `trends` | Mann–Kendall $S$ with tie-corrected normal $p$, continuity correction, and Hamed & Rao (1998) autocorrelation variance correction for $n \ge 8$ ($\mathrm{Var}(S)\cdot n/n^*$ over significant lags $|\rho_k|>1.96/\sqrt{n}$ of midranks after detrending by the Theil–Sen median pairwise slope); $\tau=S/\binom n2$ is tau-a | uses the available observations in chapter order; $n<3$ → unavailable; partial series are listed in `trend_incomplete`, with observed and missing chapter IDs in `baseline_diagnostics.features`; not tie-normalized tau-b |
| `robust_scales` | Sn: low outer median of high inner medians, including self-distances, ×1.1926; Qn: sorted pairwise distance at rank $\binom{\lfloor n/2\rfloor+1}{2}$, ×2.21914 | Gaussian asymptotic factors; no finite-sample correction; $n<2$ → 0 |
| `tail_index` | **Hill** estimator $\hat\alpha = \bigl[\tfrac1k\sum\ln\frac{x_{(n-i+1)}}{x_{(n-k)}}\bigr]^{-1}$ over the $k$ largest values | $n \ge 5$, $k=\lfloor\sqrt n\rfloor$ (or user $k\ge 2$); non-positive threshold → `None`; $k \ge n$ → `None` |
| `distribution_shift` | exact empirical-CDF Wasserstein $W_1$ and two-sample KS $D$; stable asymptotic KS $p$ | the chapter sequence is split before dropping unavailable values; both original halves need $\ge2$ observations or the feature is listed in `distribution_unavailable`; computed but partial comparisons appear in `distribution_incomplete`. Coverage is in `baseline_diagnostics.features`. $D=0$ → $p=1$; $p$ is not calibrated for tied/fitted distributions |
| `trending_features` | feature names selected by Benjamini–Hochberg FDR (`q = fdr_q`) across Mann–Kendall $p$-values | summary list |
| `segmented_features` | feature names with at least one guarded-objective changepoint | summary list |
| `shifted_features` | feature names selected by Benjamini–Hochberg FDR (`q = fdr_q`) across early/late KS $p$-values | summary list |
| `cooccurrence` *(token-level)* | content-word graph (window 2; single-character tokens excluded); approximate discrete exponent $\hat\alpha=1+n/\sum\ln(k_i/(k_{\min}-0.5))$ and fitted-CDF comparison | estimator follows Clauset–Shalizi–Newman Eq. 3.7; current truncated continuous CDF and ordinary KS $p$ do not establish discrete power-law goodness of fit; ≥50 content tokens, ≥5 positive nonconstant degrees |

The direct structural sample functions reject nonfinite observations.
Changepoints require a finite penalty, and Spearman correlation requires
equal-length pairs and stays within $[-1,1]$. Extreme finite changepoint
penalties use a rescaled objective, and extreme-scale Mann–Kendall inputs
use exact residual arithmetic for the Hamed–Rao ranks. Hill log ratios
remain in range when an intermediate ratio would overflow. These arithmetic
guards preserve the estimators and their exploratory interpretation.
| `keyness` *(token-level)* | **Dunning $G^2$** (log-likelihood ratio) of first-half chapters vs second half, content words only (single-character tokens excluded); signed so positive = over in the early half | both halves ≥ 20 content tokens; single-chapter texts omit `keyness` |

The legacy Python name `pelt_changepoints` is retained, but the implementation
does not prune or claim linear time. Its guarded singleton/constant cost does
not satisfy the PELT pruning premise in
[Killick et al., Theorem 3.1](https://arxiv.org/abs/1101.1438v3). Considering
every predecessor corrects optimization of this declared objective; the guard
is still a modelling choice, not a nondegenerate Gaussian likelihood. Anchoring
before centred variance updates limits cancellation from large offsets without
recovering precision already lost in input floats. Power-of-two rescaling
keeps the global standardization within floating-point range before squaring
the deviations. At the floor a longer constant segment has cost
$n\ln(10^{-9})$ before the penalty. This favors flat runs relative to noisier
segments of the same length and can affect proposed boundaries in quantized
measurements. An entirely constant series has no boundary at a nonnegative
penalty.

Sn's low/high medians follow the
[original definition](https://wis.kuleuven.be/stat/robust/papers/publications-1993/rousseeuwcroux-alternativestomedianad-jasa-1993.pdf).
Qn uses the modern rounded Gaussian factor 2.21914 instead of historical
2.2219, preserving its order-statistic rank. These normalizations remain
separate from finite-sample bias correction; neither estimator applies it.

Wasserstein distance integrates $|F_{\mathrm{early}}-F_{\mathrm{late}}|$ over
the distinct empirical-CDF knots. KS $D$ is the maximum CDF difference on the
same merged support. Stable evaluation of the asymptotic survival function
corrects the identical-distribution boundary and small-argument cancellation;
it does not turn the approximate $p$ into an exact, fitted-null or tied-data
calibration. Short samples and serially dependent chapters need care.

Token-level blocks (`cooccurrence`, `keyness`) are computed by
`lexical_structural_diagnostics(text, config)` and merged into
`structural_diagnostics` on the text-bearing surfaces (`api.fingerprint`,
CLI `style` / `build` / `dashboard`). `StyleFingerprint.from_metrics`
alone still yields the metric-derived keys only.

Keyness uses the full term/non-term × corpus A/B contingency table. Expected
counts are row-total × column-total / grand-total, and
$G^2 = 2\sum O\ln(O/E)$, with zero observed cells contributing zero. Lixity adds
a direction sign for over-representation in A. This follows the binomial
likelihood-ratio formulation in [Dunning (1993), §5.3](https://aclanthology.org/J93-1003.pdf).
Version 1.16.0 includes the non-term cells previously omitted from this calculation;
recompute older keyness values before comparison. A signed ranking is not a
multiple-testing-adjusted significance claim.

Since v0.7.6, near-null keyness uses exact integer table residuals and a centered
deviance series for small relative residuals, avoiding cancellation of a small
positive divergence into zero. Lag-1 sample autocorrelation uses anchored,
scaled centered moments and accurate summation to avoid avoidable overflow,
underflow and constant-sample roundoff. Constant samples remain unavailable.
These are numerical corrections to the existing estimators, not new statistical
calibrations; independent high-precision Decimal calculations cover their
extreme-scale and near-null regression cases.

The structural diagnostics retain their field names in schema 5. The structural summary
uses the implemented thresholds; it does not certify a narrative boundary,
trend or fitted distribution. See [STABILITY.md](STABILITY.md#structural-diagnostics)
for the model assumptions and current calculation limits.

### Track B / research extensions (not implemented)

Documented research directions, **not** current product features:

- **Textometry / Burrows’ Delta** (and 2026 generalisations to Jensen–
  Shannon / Rank-Turbulence Delta): authorship-attribution baselines.
  Lixity’s chapter↔rest JSD with driver words is *inspired by* this line
  but deliberately **not** an attribution instrument (see STABILITY §1).
  There is **no external Delta stylometry** against a reference corpus;
  a future Delta panel would rank chapters against such a corpus — out of
  scope while the product stays manuscript-intrinsic. Structure-module
  caveats (empty `signal_counts`, filter-list definitions, pacing without
  dividers, no NER/speaker attribution) are registered in STABILITY §2
  and summarised in AGENTS §3.5.
- **OHCO / TEI**: OHCO means [Ordered Hierarchy of Content Objects](https://experts.illinois.edu/en/publications/what-is-text-really/),
  a document-model thesis; TEI supplies scholarly text-encoding guidelines. Lixity’s input contract
  is UTF-8 Markdown with `## ` chapter headings (configurable
  `chapter_regex` / `appendix_marker`); a TEI→Markdown ingest path would be
  the natural bridge, not a second analysis core.
- **Hermeneutic loop / Foregrounding (Mukařovský)**: deviation from a
  text’s *own* norm is the literary signal — already the design principle
  of the self-calibrating house style. A deeper hermeneutic layer (quotes,
  interpretive commentary tied to flagged cells) is UI/agent territory, not
  a new estimator.

### Track C / pedagogy (not implemented)

- Worked examples that walk one chapter from KPI → heatmap → paragraph →
  marker, suitable as a tutorial on the project page.
- Glossary of every passport key for non-statisticians (beyond `llms.txt`).
- Exportable method cards for every metric in replication packages. The
  [scene method cards](#scene-evidence-and-dramaturgical-rehearsal) are documented
  here.

## 5. Exploratory style dimensions

The dimensions are PCA of standardized tied midranks on one common complete
chapter set. Covariance, loadings, explained variance and scores use that same
rank space:

1. Start with baseline-usable features and select chapters measured on every
   candidate feature. At least three complete chapters are required.
2. Give tied values their average rank within this set. Centre each rank column
   and divide by its sample standard deviation ($n-1$ denominator). Drop
   columns constant on this set; at least three varying features must remain.
3. Form $C=X^\mathsf{T}X/(n-1)$ and use cyclic Jacobi eigendecomposition
   (standard library only). When $n \le p$ ($\lambda = \min(0.5, \max(0.1, (p-n+1)/(p+n)))$)
   or $\lambda_{\min} \le 10^{-6}\lambda_{\max}$ ($\lambda = 0.05$), ridge shrinkage
   $(1-\lambda)C + \lambda I$ is applied before re-running Jacobi
   eigendecomposition. Eigenvalues are sorted descending; the largest-absolute
   loading fixes each axis sign. `StyleFingerprint` also computes regularized
   Mahalanobis distances $D_M(c) = \sqrt{\sum_k (v_k^\mathsf{T} r_c)^2 / \max(\mu_k, 10^{-6})}$
   per complete chapter (`mahalanobis_distances`, `top_deviants(..., metric="mahalanobis")`).
   Here $r_c$ is the standardized midrank row and $\mu_k$ is an eigenvalue
   of the regularized matrix.
   **Since v0.9.1:** the vector in this distance is the same centered,
   standardized midrank row used to construct C. Chapter z* cells are never
   substituted. `dimension_diagnostics.mahalanobis_space` identifies the space
   as `standardized_midranks`; earlier builds could mix coordinates when z*
   cells were present. Recompute distances before comparing those builds.
4. Project the same standardized ranks: $s_k=Xv_k$. Only the common complete
   chapters receive `scores`; missing measurements are not imputed. The
   reported `variance` is $\mu_k/p$ for $p$ unit-variance columns, the
   eigenvalue share of the regularized rank matrix. When shrinkage is active,
   this is not the empirical fraction of variance of the projected scores.
   Ridge toward the identity changes eigenvalues, not the matrix's eigenvectors
   (apart from numerical choices within degenerate eigenspaces). The UI exposes
   lambda and the complete-chapter/feature counts; axes are exploratory
   projections, not established literary registers.
5. A completed, unrounded score with |score| ≥ `dim_score_threshold` (default
   2.5) puts a chapter in `flagged` on that axis. Scores are stored rounded to
   two decimals; the cutoff remains descriptive, not a calibrated probability.

The dashboard also reports each axis's sample standard deviation, calculated
from the unrounded chapter scores with an $n-1$ denominator, and expresses the
same raw-score cutoff as a multiple of that deviation. This exposes that a
common raw cutoff is not equally selective on axes with different variances;
it does not change the scores, flags or configured cutoff. An axis with score
standard deviation at most $10^{-6}$ times that of the leading axis is treated
as numerically too small for this conversion, so its relative cutoff is
unavailable. Neither the scale nor the cutoff is a confidence interval or a
test of literary quality.

Fewer than three complete chapters or varying features yields no dimensions.
Incomplete chapters remain available in the other measured-feature views but
do not receive dimension scores. The complete-case subset can be small or
unrepresentative, and ranks depend on the supplied manuscript. Explained
variance does not mean literary importance or a simultaneous confidence region.

The separate redundancy list still compares each pair's available chapters:
|Spearman $\rho$| ≥ `REDUNDANCY_RHO` (0.8). Pairwise availability in that list
does not define the PCA matrix or its scoring population. The list is capped
at the ten strongest pairs.

## 6. Lexical diversity indices

| Index | Definition sketch | Guard |
| :--- | :--- | :--- |
| Guiraud $R$ | $\mathrm{TTR} \sqrt{N}$ | length-dependent; prefer with HD-D |
| HD-D | hypergeometric expected TTR of one 42-token draw without replacement from whole-text type frequencies | $\ge 100$ tokens else `null` |
| MTLD | arithmetic mean $\tfrac12(N/F_{\mathrm{forward}}+N/F_{\mathrm{reverse}})$; factor completes at TTR ≤0.72 with minimum-run guard `DEFAULT_MTLD_MIN_FACTOR_LEN = 5`; trailing weight $(1-\mathrm{TTR})/(1-0.72)$ | $\ge100$ tokens; zero factors/all-unique input → `null` |
| MATTR | mean TTR over sliding 50-token windows (`mattr()`) | returns `null` below window length |
| Maas $a^2$ | $a^2 = (\log_{10} N - \log_{10} V)/(\log_{10} N)^2$ | $\ge 100$ tokens; base 10 as in the implementation |
| Yule $K$ | $10^4 \cdot (\sum m^2 V_m - N)/(N(N-1))$ | finite-sample denominator $N(N-1)$; `0.0` for $N \le 1$ or all-unique tokens |

MTLD now averages directional $N/F$ scores arithmetically, following the
original-style `mtldo` aggregation in the
[author-lab TAALED reference](https://github.com/LCR-ADS-Lab/TAALED/blob/f3c39692b01efa84e39e4de69f8ac109ac1c4bcd/taaled/ld.py).
The previous combination averaged factors first, yielding the harmonic mean
of directional scores. Lixity retains its inclusive threshold and fractional
remainder while enforcing `DEFAULT_MTLD_MIN_FACTOR_LEN = 5` tokens per completed
factor so tiny initial repetitions cannot trigger premature resets. TAALED's
segmentation conventions differ, so complete tool equivalence is not claimed.
The original McCarthy–Jarvis full paper was unavailable for this review; the
author-lab source supports the narrower aggregation claim. See
[STABILITY.md](STABILITY.md#lexical-diversity) for comparison limits.

The 100-token floor is a local short-text policy, not a universal reliability
threshold. Maas is defined for a one-type text: $N=100$, $V=1$ gives $a^2=0.5$.
The direct API rejects negative or inconsistent counts. A zero type count or
an input below the token floor returns `null`. Guiraud $R=V/\sqrt{N}$ remains
length-dependent and does not make arbitrary texts directly comparable.
When $N$ and $V$ are close, the direct Maas calculation evaluates the
logarithm of the ratio with `log1p` to keep the difference resolvable.

For $N$ tokens, type counts $f_t$, and draw size $d=42$, the implemented
expectation is

$$
\mathrm{HD\text{-}D} = \frac{1}{d}\sum_t
\left(1-\frac{\binom{N-f_t}{d}}{\binom{N}{d}}\right),
$$

where $\binom{N-f_t}{d}=0$ if fewer than $d$ non-$t$ tokens remain. The
frequency histogram makes the result independent of token order. The public
`seed` and `min_samples` arguments remain accepted legacy no-ops that emit a
`DeprecationWarning` when explicitly supplied. Ordinary calls omit them and
remain warning-free. The second value of `hd_d_stats` is `0.0` because this
exact expectation has no Monte Carlo sampling error; it does not estimate
uncertainty about a population of possible texts.

Before version 1.16.0, the `hd_d` key held mean Gini–Simpson diversity over
sampled, contiguous 35-token windows, with a window-based plug-in SE. Those
numbers are **not comparable** with corrected HD-D even though the JSON key is
unchanged. Reanalyze the original manuscript and regenerate chapter metrics,
style baselines, reports, and passports before comparing or publishing results
across that boundary. The new 100-token floor also makes values available for
100–174-token inputs that previously returned `null` by default.

## 7. Language-specific readability

Seven named formula variants, selected by profile; the implemented coefficients
are fixed and covered by hand-computed tests:

| Lang | Formula (name) | Implemented formula |
| :---: | :--- | :--- |
| de | Amstad / Flesch-De | $180 - 1.0\cdot\mathrm{ASL} - 58.5\cdot\mathrm{ASW}$ |
| en | Flesch | $206.835 - 1.015\cdot\mathrm{ASL} - 84.6\cdot\mathrm{ASW}$ |
| fr | Kandel-Moles | $207.0 - 1.015\cdot\mathrm{ASL} - 73.6\cdot\mathrm{ASW}$ |
| es | Szigriszt-Pazos | $206.835 - 1.0\cdot\mathrm{ASL} - 62.35\cdot\mathrm{ASW}$ |
| it | Franchina-Vacca | $217.0 - 1.3\cdot\mathrm{ASL} - 60.0\cdot\mathrm{ASW}$ |
| pt | Martins | $248.835 - 1.015\cdot\mathrm{ASL} - 84.6\cdot\mathrm{ASW}$ |
| nl | Douma | $207.0 - 0.93\cdot\mathrm{ASL} - 77.0\cdot\mathrm{ASW}$ |

$\mathrm{ASL}$ = words per sentence; $\mathrm{ASW}$ = syllables per word
(heuristic syllable counter), not syllables per 100 words. These scores are
not clipped to 0–100. Empty or fully unmeasurable input returns `0.0` as an
explicit unavailable sentinel, not a readability score. The coefficients above match `language_data.READABILITY`;
correct formula dispatch is not empirical validation on every manuscript. **LIX** uses the
standard Björnsson cut: words with **more than six characters**, for every
language: $\mathrm{LIX} = \mathrm{ASL} + 100 \cdot \frac{\text{long words}}{\text{tokens}}$.

Under Manuscript measurements, the report places both heuristic formulas beside
the analyzed word-token count, detected sentence count, and ASL. The Flesch
variant shows ASW and the estimated syllable total. LIX shows the long-word
count and its share of analyzed tokens. The analyzer retains the two raw totals
for live rendering. Serialized metrics omit those totals, so reports rendered
from serialized metrics can show the available formula values and counts only.

The Spanish syllable estimate counts orthographic vowel nuclei: standalone
closed vowels (`i`, `u`) count, open/unstressed-closed combinations and distinct
closed-vowel pairs can share a nucleus, and marked hiatus remains separate.
Triphthongs use the closed/open/closed pattern. Standard silent `u` in
`que`/`qui`/`gue`/`gui` is omitted; pronounced `ü` is retained, and interposed
`h` does not itself block grouping. These bounded spelling rules follow the
RAE/ASALE explanations of [diphthongs](https://www.rae.es/dpd/diptongo),
[hiatus](https://www.rae.es/dpd/hiato) and [the letter u](https://www.rae.es/dpd/u).
They are an orthographic proxy, not phonetic transcription: regional hiatus,
foreign names and loans, and poetic synaeresis remain outside the estimate.
Regression examples do not establish language-wide accuracy or reader comprehension.

The generic counter uses Latin `a–z` vowel groups. A token with no retained
letters contributes zero estimated syllables. When no token in a manuscript has
retained syllable letters (`asw == 0.0`, for example in non-Latin scripts under
`generic`), Flesch returns the `0.0` unavailable sentinel and displays as
unavailable (`–`) across dashboard, CLI, Markdown and reading-site reports while
LIX remains available. Generic ASW and derived
syllable-based readability are unsuitable for comparing texts in scripts
outside that alphabet. The word tokenizer can still recognize those tokens.

**Since v0.7.2:** the estimator corrects skipped closed-vowel nuclei in Spanish, for example
`vivir` from one estimated syllable to two and `dibujo` from one to three.
This changes Spanish ASW and its derived readability score without changing
the formula coefficients or JSON fields. Regenerate Spanish reports before
comparing results across this correction.

## 8. Jensen–Shannon divergence (chapter ↔ rest)

$JSD(P \| Q) = \tfrac12 D_{\mathrm{KL}}(P \| M) + \tfrac12 D_{\mathrm{KL}}(Q \| M)$
with $M = \tfrac12(P+Q)$. The implementation uses natural logarithms, so the
divergence is in $[0,\ln 2]$ nats. It is zero for identical distributions,
regardless of their token counts. This is the equal-weight form of
[Lin's Jensen–Shannon divergence (1991, §IV)](https://www.cise.ufl.edu/~anand/sp06/jensen-shannon.pdf).
Driver words present in the chapter are ranked by their positive additive
contribution, excluding configured function words, stopwords and
single-character tokens. This display filter does not change the divergence.
Types absent from the chapter contribute half their rest-corpus probability
times $\ln 2$; their total probability is calculated from the observed rest
distribution. No square root or base-2 rescaling is applied.

The interface names the observable **Word distribution (JSD)** and explains the
divergence. It does not label this number a mathematical distance: the
[Jensen–Shannon distance](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.jensenshannon.html)
is its square root. Topics and proper names can change word distributions without
establishing a change of writing style.

**Since v0.7.2:** absent-type mass is computed from remaining
integer token counts, and contributions are accumulated with `math.fsum`.
Near equal probabilities, the same per-type contribution is evaluated as
$m[d\mathrm{atanh}(d)+\tfrac12\ln(1-d^2)]$, where
$m=(p+q)/2$ and $d=(p-q)/(p+q)$; the contrast is derived from count cross-products
before probabilities are rounded. This avoids cancellation of first-order
logarithmic terms. No fixed epsilon suppresses small genuine divergence.
Unchanged-rate words are omitted from the driver list; identical distributions
return zero and an empty list. The definition, natural-log units and JSON fields
are unchanged.

Version 1.16.0 corrects the absent-type probability calculation, which could
previously produce negative divergence. Recompute older metrics before comparing
chapter profiles across this release. With no chapter tokens or no remaining
corpus tokens, `0.0` and an empty driver list mean unavailable, rather than
measured agreement. JSD uses empirical token frequencies and ignores word order
and narrative context. Its values and driver rankings are descriptive; they
provide no calibrated probability, significance test, quality assessment,
attribution or historical-accuracy judgment.

## 9. Paragraph layers (within-chapter colouring)

Each chapter supplies its own reference from at least three eligible
paragraphs. The comparison subtracts the chapter's median and divides by
the chapter scale. The scale is $1.4826 \cdot \mathrm{MAD}$ when MAD is
positive. For varying values with zero MAD, the comparison tries Sn and
then Qn as defined in the [robust scale table](#4c-structural-diagnostics-structural_diagnostics).
When the scale remains zero, as it can for constant or heavily tied values,
the paragraph measurement remains available and its comparison score is
unknown. Fewer than three eligible paragraphs also leave the score unknown.
`layer_stats()` requires at least five words per paragraph for the function-word
share and pattern rates. Sentence length and quoted-word share need at least
one word. Color shows the direction and magnitude of the chapter-local score.
A paragraph is marked at $\lvert z \rvert \ge 1.5$ after rounding $z$ to two
decimal places.

Paragraph evidence draws on the same counting projection as the profile. A
known rule may find zero matches. A missing rule in the effective profile
leaves its evidence count unknown and its reader comparison unavailable.
Explicitly configured empty cue patterns count zero. If counted contributions
cannot map back to the displayed text, the count remains available and only the
mapped contributions yield highlights.

The **Signal-group comparison** (command `showing`, `showing.py`) standardizes each raw signal
against the manuscript's chapter median/MAD, then averages each group with equal
within-group feature weights: `tell_z` averages the four word-pattern densities
(`filter_density`, `modal_density`, `passive_density`, `nominalization_density`,
weight `1/4` each) and `show_z` averages the two share cues (`dialog_pct`,
`staccato_pct`, weight `1/2` each). The displayed difference is
`balance = show_z - tell_z` (second group minus first). Zero spread uses
the population standard deviation when available. This fallback translates and
normalizes finite offsets before computing the deviation to avoid intermediate
overflow or underflow; the median-centred population-deviation formula is unchanged.
The `tell_z`/`show_z` names are
machine identities, not evidence for a validated narrative-distance construct.
Fewer than three sufficiently long chapters leave component scores and means
unavailable. Both groups also require the counting rules for all of their
components. For example, a language-neutral profile with no word-pattern rules
has no group scores. With sufficient chapters, a constant component has zero relative
variation. `most_telling` and `most_showing` are empty when balances are
unavailable or identical; chapter-order ties are not evidence of a ranking.
These signals describe relative patterns, not prose quality.

## 10. Determinism contract

- No wall-clock in the analysis path; HD-D is an exact frequency calculation.
- Float operations in fixed order on the same interpreter → byte-identical
  HTML/JSON (platform last-bit differences are documented in STABILITY).

## 11. Linguistic analysis (tense, dialogue, sentences, scenes)

### Optional grammatical analysis

The optional `tense_model` setting selects contextual POS/morphology/dependency
analysis with an explicitly installed local spaCy or explicitly profiled Stanza
pipeline. Language-specific composition covers de/en/fr/es/it/pt/nl. `grammatical_tense.py`
composes auxiliary-linked German verbal complexes using TIGER `oc`/`pd` or UD
`aux`/`aux:tense`/`aux:pass`/`cop` relations (English also `auxpass`), with
coordinated auxiliary inheritance and shared nonverbal predicate heads. French/Italian
reflexives and positive intransitive auxiliary licensing distinguish some perfect
forms from simple be-passives; unlicensed ambiguous forms remain limited. This is an
independent implementation informed by [IDS Grammis](https://grammis.ids-mannheim.de/progr%40mm/1695)
and [Dönicke (2020)](https://aclanthology.org/2020.tlt-1.1/), not a reproduction of
that paper's evaluated system. The published 92.6% score does not apply to Lixity.

Nested coordination follows the [UD conjunct chain](https://universaldependencies.org/u/dep/conj.html),
stopping at a finite component instead of borrowing across a separate finite
clause. A shared token validator rejects duplicate/missing indices, cycles and
source-span mismatches; expanded words may share their original token span.

The finite carrier's tense and mood are composed with participles, infinitives,
replacement infinitives and passive auxiliaries. Resolved simple present maps
to present; preterite, imperfect, perfect, pluperfect and anterior perfect map to
past. Absent English/Dutch Mood features remain `unmarked`, not indicative.
In `verb_grammar.py`, German subjunctive splits Konjunktiv I (`mood="subjunctive_i"`,
`Mood=Sub` + `Tense=Pres`) from Konjunktiv II (`mood="subjunctive_ii"`,
`Mood=Sub` + `Tense=Past`), and `würde + Infinitiv` resolves to
`tense="conditional"` (or `conditional_perfect` with `haben`/`sein`) instead
of indicative `future`. Future and subjunctive
forms remain separate and do not enter the binary counts. Ambiguous unlicensed
`sein`/participle complexes remain unresolved. The existing curated `sein` inventory
provides positive licensing only, not a complete valency lexicon.

Each canonical prose paragraph is parsed consistently across corpus/profile calls;
quotation scope is resolved over chapter-bounded prose before counting. Exact
immutable parse results have a process-local LRU bounded to 256 entries and one
million input characters. Models are explicitly loaded and cached; changing a
model installation requires restart. The engine never sends text to a provider.
The grammatical record carries a versioned policy and runtime/model identity;
UI cue mapping still uses the existing NFC-to-original-source projection.

This resolves many suffix collisions without certifying grammatical accuracy.
See the [bounded evaluation and known errors](STABILITY.md#grammatical-tense).



These heuristics are transparent rules over curated resources, not a
grammatical parser. Their constants and guards live in the named modules.
Shared mathematical primitives (robust scale, significance z, normal tail,
ratio/share/density totalization, plug-in standard errors and published effect
bands) come from `lixity.math_core`; heuristics import them instead of
restating formulas.

| Heuristic | Rule | Limits |
| :--- | :--- | :--- |
| Sentence-length distribution | By default ≤ 6 / 7–15 / 16–25 / > 25 words (`analyzer.py`) | Project sentence boundaries control these four bins. Tokenless fragments are excluded. |
| Rhythm entropy | By default ≤ 6 / 7–20 / > 20 words (`pacing.py`, `rhythm_profile`) | The three-bin entropy uses its own medium/long threshold. Its buckets and entropy are comparable between reports with the same settings. |
| Hook | Closing sentence ≤ `HOOK_SHORT_SENTENCE` (8) words, ending in `?`, `!` or `…`, or containing detected dialogue (`pacing.py`) | Each condition adds one point; the displayed mean is over chapter endings, not scenes. This is not a validated suspense measure. Only the ellipsis character scores; `...` does not |
| Sentence-start monotony & adjacent overlap | `repeated_start_runs`: count of runs of ≥ `MONOTONY_MIN_RUN` (3) consecutive sentences in the same paragraph starting with the identical lowercased word token; `sentence_overlap_pct`: share of within-paragraph adjacent sentence pairs sharing at least one lowercased content word (tokens of length ≥ 2 not in `function_words`, or length ≥ `COHESION_FALLBACK_MIN_LEN` = 4 when `function_words` is empty) (`pacing.py`) | Repeated starts can be deliberate anaphora or unwitting monotony; lexical overlap ignores synonyms, pronouns, morphology and cross-paragraph links |
| Dialogue paragraph | ≥ 50 % of the paragraph's words inside chapter-wide recognized dialogue spans (`dialogue.py`); a span may cover multiple paragraphs | Quotation conventions differ per language; an unrecognized or unclosed quotation is not counted |
| Dialogue cadence & voice contrast | `short_turns` / `short_turn_pct`: quoted spans with 1–`SHORT_TURN_MAX_WORDS` (12) words; `long_turns`: quoted spans with ≥ `LONG_TURN_MIN_WORDS` (80) words; `dialogue_asl` vs. `narration_asl` and `asl_contrast = dialogue_asl - narration_asl` over recognized quoted spans vs. chapter prose outside unioned quoted spans (`dialogue.py`) | Split quotes around a reporting clause count as separate spans (`"Alpha," she said, "and beta."`); `asl_contrast` is `null` when either quoted speech or unquoted narration is absent |
| Tense mixed/switch | `mixed`: ≥ 2 present and ≥ 2 past markers and minority share ≥ 25 %; `switch`: the dominant tense changes between consecutive paragraphs (`style_profile.py`) | Lexical cues and language-specific patterns are incomplete and can be ambiguous; they are not grammatical parses. Since v0.7.7, an unknown German `-te/-ten/-test` ending alone is not a past cue; no productive present pattern |
| Sentence splitter | Language abbreviation tables, digit and initial guards; utterance `no.`/`co.` split; prose splits keep blank-line block boundaries (`split_prose_sentences`) | Tables are curated and incomplete; tokenless fragments are not sentences; an unterminated block stays one fragment unit with its token length |
| Severity | `classify_severity` truth table; defaults: 3 = switch + mixed + minority ≥ 3, 2 = (switch + minority ≥ 2) or (mixed + minority ≥ 3), 1 = either, 0 = neither | Only `flag_min_severity` reaches CLI/API/config; other `ProfileThresholds` fields need direct `ParagraphProfiler` construction |
| Dominance | Neutral with at most one marker; otherwise present when `present/(past+ε) > 1.5`, past when `< 0.67`, mixed within the band; ε = 0.001 (`style_profile.py`) | Ratio bands are conventions, not measured boundaries |
| Nominal/adjective suffixes | Curated suffix cues; default nominal cues exclude curated function words (`language_data.py`) | Over-include (e.g. `month/health/truth`, `König/Saal`, `Musik/Natur`); adjective cues have no equivalent function-word exclusion |
| Modal lexicons | Curated forms per language | Unequal morphology coverage; not cross-language comparable |

**Since v0.7.6:** nominal ending lists include selected plural forms in each
language, including `Entscheidungen`, `decisions`, `décisions`, `decisiones`,
`decisioni`, `decisões` and `beslissingen`. German `zur` belongs to the curated
function words and is excluded from default nominal matches. This corrects
number-dependent undercounting and a suffix collision; it does not distinguish
nouns from homographic verbs or establish nominal writing style. Explicit
`nominal_regex` overrides still replace the default rule. Recompute affected
densities and derived comparisons before comparing older reports.

The UI calls this measurement **Noun endings**, rather than claiming to measure
nominal style. Nominal style can express an action as a noun phrase ("the
examination" rather than "we examine"); a suffix counter cannot establish that
syntactic choice. Localized examples explain the distinction before the
counted-text and statistical comparison instructions. Counts and numeric keys
are unchanged by this presentation.

The analogous **Adjective endings** measurement counts selected suffix matches,
not grammatical adjective tokens or attributive syntax. Untagged word patterns
can both miss adjectives and match other word classes. Participle-shaped words
also need context: the [Universal Dependencies annotation guidance](https://universaldependencies.org/u/dep/aux-pass.html)
explicitly distinguishes passive auxiliaries from copular uses of participles.
The lightweight passive measurement therefore remains a cue count; a match does
not resolve whether an ambiguous participle is adjectival or verbal.

Configured cue patterns override the profile patterns for direct Python calls.
**Since v0.7.6:** `lixity.tense.TenseMatcher` owns tense counting for chapters,
scenes and paragraph profiles. With default patterns, a standalone productive
past candidate, or a pronoun-plus-finite candidate, is rejected when the finite
word is explicitly listed as present and not past in the curated inventory.
Auxiliary-plus-participle candidates are preserved, including participles that
also occur as finite forms (`haben erzählt`, `a écrit`). This corrects collisions such as
German `halten` and Dutch `Wij moeten`; it does not infer syntax from endings.
**Since v0.7.7:** German removes the unrestricted weak-past suffix rule used in
v0.7.6: `feuchten` and `kunstvollsten` no longer become past cues merely from
their endings. Selected forms of `üben` and `singen` have been added to the
lexicon, including `übt`; unknown regular past forms such as `flatterten` can
now be missed. Listed forms can still be ambiguous, as can auxiliary/participle
matches. This intentionally changes the counts and dependent results; regenerate
analyses before comparison and review old decisions against the new evidence.
The default German present matcher skips capitalized cue spellings immediately
after selected fused prepositions and articles, such as `beim Lesen`. This uses
the spelling of a nominalized form as a bounded cue. Sentence-initial finite
forms and explicit user patterns retain their matching behavior.
[Official German spelling rules, §55](https://grammis.ids-mannheim.de/rechtschreibung/6193)
In German, listed auxiliary/participle pairs additionally form one past cue;
their contained lexical matches are consumed, so three recognized perfect
constructions give three past cues and no present-auxiliary double count.
Productive lowercase `ge-…-t/-en` and `-iert` candidates can additionally resolve
with a form of `haben` at a bounded punctuation/end-of-text predicate-head edge.
Weak `ge-…-t` stems require at least two letters (`geübt`, `geölt`); strong
`ge-…-en` and `-iert` stems require at least three. A bounded inventory of
separable preverbs also admits forms such as `eingekauft`, `aufgeräumt` and
`abgeholt`. Curated finite forms and function words remain excluded. This covers `habe geschlafen/getroffen/gehabt`
without expanding the participle inventory. An immediately following `worden`
also licenses the passive perfect with `sein`, including `ist renoviert worden`.
An unlisted `sein` + participle without `worden` remains unresolved. This is
incomplete morphology: unlisted/combined preverbs and inseparable-prefix forms
such as `wiedergutgemacht` and `vorbereitet` remain outside the new productive rule.
No new `sein` licensing is inferred from a recognized prefix. Nominal/adjectival continuations
are not resolved merely because a word has a matching ending.
The German display label is therefore `Vergangenheit`, not the narrower
grammatical form `Präteritum`.
Up to three intervening words are allowed in a bounded word window. Punctuation, blank
lines, conjunctions and intervening listed finite verbs/auxiliaries stop the scan.
The rightmost listed candidate within that window owns the span, so a preceding
participial modifier does not create a second past cue (`geschlossen gehalten`).
Listed `sein … worden` passive-perfect patterns follow the same span ownership.
The auxiliary selection follows the distinction described by
[IDS grammis](https://grammis.ids-mannheim.de/fragen/86), which also documents
regional and object-dependent variants. Inventory absence is not proof of
incompatibility: unresolved pairs retain lexical ambiguity, including state,
regional and transitive readings. Unlisted compounds, longer gaps and other
languages are not a complete grammatical tense analysis. German nominal
capitalization rejects broad compound guesses such as `habe Bedenken`;
it is a cue guard, not part-of-speech tagging.

Explicitly overriding either tense pattern preserves
independent pattern counting, including empty patterns. The review-policy identity
changes with these semantics, so saved decisions require renewed review rather
than silently carrying over to a changed measurement.

**Since 0.8.1:** With the default Spanish lexical patterns, an adjacent
`he/has/ha/hemos/habéis/han` plus a detected regular `-ado/-ido` participle
candidate counts as one past cue, without a separate present cue for the same
auxiliary. A blank paragraph boundary prevents that suppression; the pre-existing
past regex can still span such a boundary when whole text is counted. RAE's
[verb tables](https://www.rae.es/sites/default/files/biblioteca/pdf/23_VII_50/23_VII_50.pdf)
describe `haber` plus a participle as a compound form. The rule remains a
surface-pattern heuristic: irregular participles, intervening adverbs (see
[Felíu Arquiola and Pato, 2015, p. 69](https://revistas.rae.es/brae/article/view/37/113)),
regional interpretation and other constructions are not resolved by
this rule. A detected compound is assigned to Lixity's broad past bucket, not
an assertion that its temporal reference is always past. Custom patterns and
contextual models keep their own behavior. The Spanish review context changes
when the default lexical rule is used; saved decisions then require renewed review.

Passive patterns retain auxiliary context while allowing shorter regular stems
and selected irregular forms (`rotas`, `rotte`, `lette`, `lues`, `lidas`) and
Spanish accented `leídas`. Irregulars need lexical coverage; lowering a stem
length alone would not recognize them (see the
[RAE participle reference](https://www.rae.es/gramática/morfología/verbos-irregulares-iv-pretéritos-fuertes-y-participios-irregulares)).
Morphology-specific limits keep French `est ici` and `est plus grand` outside
the expanded short accented-participle pattern. Italian `stato/stati` can be
intermediate auxiliaries before a lexical participle, not passive heads by
themselves. Negative examples such as `son vida`, `est si`, `are red` and
`sono stati a casa` constrain broadening.
German `sein + participle` state passive is not silently added to the event-
passive metric. A zero remains zero detected cues, not proof of active voice.

Cue patterns (including `dialogue_regex`) use the case-insensitive cue
contract from §2 across the analysis core and the `dialogue`/`pacing` reports.
Quotation boundaries are recognized over chapter-bounded semantic prose. Blank
paragraphs can continue a paired quotation. Chapters, explicit scene breaks
and separate Markdown quote blocks bound recognition. Physical line starts
survive paragraph folding for language profiles that accept marked replies.
An open or mismatched delimiter marks an uncertain region. Recognized ranges
and uncertainty project to paragraph evidence through the same source map.

For a configured quotation pattern, the full match selects the quotation when
there are no capture groups. Otherwise, the first group selects it. An unmatched
optional first group supplies an empty turn. The word share counts a subset of
the word matches from the current scope. The effective word range is the single
word capture if present, or the full match. A word contributes once if its
nonempty range is fully contained in the union of recognized passages.
Separate `turn_words` may count a word in each overlapping custom turn. Corpus,
chapter, scene and paragraph denominators follow their documented prose scopes.
The corpus metric tokenizes the full supported prose. The separate dialogue
report sums independently measured chapters. Custom word patterns anchored to
the start of a scope can produce different totals for these two measurements.
Classification and character attribution require additional evidence beyond
punctuation.

**Since v0.9.1 (prosody, segmentation, tense, dialogue & scene guards):**
- **Syllables (`syllables.py`):** `count_it()` strips silent `u` in `que/qui/gue/gui` and merges rising `[iu]` + vowel diphthongs; `count_de()` applies `DE_CLEAN` with an empty-word guard and normalizes `qu -> k`; `count_fr()` adds exceptions for `-ment` mute-verb forms (`FR_MENT_MUTE_VERBS`), `souvent` (`FR_NON_MUTE_ENT`), and `-éC+ent` endings (`FR_PENULTIMATE_E_ACUTE_ENT`); `count_en()` preserves `-Cle(d|s)` syllabic `l` endings (`table`/`bottled`/`handles`).
- **Sentences (`sentences.py`):** protects spaced multi-part abbreviations (`z. B.`, `d. h.`, `u. a.`, `o. ä.`, `p. ex.`, `d. w. z.`), accented single-letter initials (`É. Zola`), ellipses, and post-quote lowercase dialogue tags (`"Hello." she said`).
- **Tense spans (`tense.py`):** German `_german_perfect_spans()` extends the bounded clause window to `_PERFECT_MAX_CLAUSE_WORDS = 12` tokens and supports subordinate clause-final backward scans (`..., weil er das Buch gelesen hat`); English `_english_perfect_spans()` consumes `have/has/had + VBN` (regular `-ed` or `_EN_IRREGULAR_PARTICIPLES`) as a single past cue without double-counting the auxiliary.
- **Dialogue, indirect speech, scenes & characters (`dialogue.py`, `scenes.py`, `characters.py`):** Romance dialogue defaults (`fr`, `es`, `it`, `pt`) recognize line-initial dialogue dashes (`^[—–]`); `find_dialogue_tag_spans()` clamps tag searches at sentence terminators (`.`, `!`, `?`) and adjacent quote boundaries; German indirect-speech cues cover reporting/cognitive verbs with `dass`/`daß`/`ob`, third-person pronoun + *Konjunktiv I*, and reporting/cognitive verb + comma + pronoun + *Konjunktiv II*; French non-manner `-ment` nouns are excluded from `adverbial_tags`; unconfigured `scenes.py` character cues guard against German sentence-internal capitalized nouns; and `characters.py` supports optional `case_sensitive` matching.

- `python -W error` test run + `mypy --strict` + ruff gate every change.

## 12. Voice-reference signal diagnostics (`audio-reference inspect`)

Descriptive measurements of a saved mono 16-bit PCM reference, computed offline
with the standard library (schema `lixity-audio-reference-quality/1`,
`method = "heuristic-uncalibrated"`). They describe the recording; they are not
a quality score and say nothing about transcript accuracy or voice identity.

- Peak: `20·log10(max|x| / 32768)` dBFS; clipped ratio: share of samples with
  `|x| ≥ 32760`.
- Frame powers `P_f = mean(x²)/32768²` over 20 ms frames. Speech level is
  `10·log10(mean P_f)` over frames at or above the median frame power; noise
  floor is `10·log10` of the 5th-percentile frame power, floored at −120 dBFS.
- Bandwidth: Hann-windowed 1024-sample frames (hop 512) at or above the median
  frame energy, at most 64 evenly spaced, are averaged into a power spectrum.
  With `B₀` the mean power below 1 kHz, the bandwidth is the upper edge of the
  highest 500 Hz band whose mean power is at least `10⁻⁷·B₀` (−70 dB).
- Notes (`clipping`, `low_level`, `high_noise`, `digitally_silent_pauses`,
  `band_limited`, `silent`) apply fixed thresholds: clipped ratio > 0.1 %,
  speech level < −35 dBFS, speech-to-floor gap < 30 dB, floor ≤ −90 dBFS and
  bandwidth < 80 % of the Nyquist frequency. These thresholds are engineering
  guesses, not validated limits.
- A value that cannot be determined (for example for pure silence) is `null`
  with a note.

<a id="13-chapter-audio-audit-unreleased"></a>

## 13. Chapter audio audit

`audio-inspect` and `audio-verify` use `audio_audit.py` and emit
`lixity-audio-audit/1`. These are descriptive signal measurements and an optional
comparison against externally supplied word-timing evidence, not speech
recognition or a quality score. The separate voice-reference API above keeps its
existing schema and formulas.

For integer PCM of width $b$ bits, center unsigned 8-bit samples first and
normalize each sample as $x=s/2^{b-1}$. Duration is frame count divided by sample
rate. For each channel and across all channel samples:

- Peak is $20\log_{10}(\max |x|)$ dBFS.
- RMS level is $20\log_{10}(\sqrt{\frac{1}{N}\sum_{i=1}^{N}x_i^2})$ dBFS.
- DC offset is $\frac{1}{N}\sum_{i=1}^{N}x_i$ in full-scale units.
- Clipped-sample fraction counts samples at either integer endpoint,
  $-2^{b-1}$ or $2^{b-1}-1$, divided by the number of samples.

Aggregate RMS pools channel samples; channels are not averaged into a mono
waveform, so opposite-polarity stereo does not cancel. A zero level is negative
infinity dBFS, represented by `null` with an explicit limitation. Compressed or
floating-point inputs are measured after decoding to integer PCM. Bandwidth and
noise floor are unknown in this chapter audit, with reasons; it does not separate
speech from background noise or infer a long-recording bandwidth limit.

Silence is a level heuristic. Each approximately 20 ms window is silent only if
every channel's RMS is at or below −50 dBFS. Consecutive qualifying windows form
an interval when their duration is at least 0.1 seconds. Actual window duration
is reported. The first 10,000 intervals are returned; total interval count and
silent duration remain complete, and a truncation flag marks the omitted list.
These thresholds are uncalibrated and do not classify natural pauses.

Comparison requires a transcript tied by SHA-256 to the exact input audio bytes.
The companion command `lixity audio-import-transcript` converts external word-timestamped
ASR representations (e.g., OpenAI Whisper segments/words or arbitrary timestamped word lists)
into validated `lixity-audio-transcript/1` documents while computing the cryptographic binding.
Plan and transcript words use the explicitly selected language's word tokenizer,
with NFC normalization and lowercase matching. `SequenceMatcher(autojunk=False)` compares
token sequences after equal prefix/suffix trimming; its alignment is not a
phonetic alignment or a minimum edit-distance guarantee. Coverage is matched
expected tokens divided by all expected tokens. A transcript replacement or
extra word uses its supplied timestamps; missing expected words have no measured
timestamp and retain only neighboring bounds. No comparable tokens or missing
transcript evidence yields unknown rather than a perfect score.

For fully matching adjacent spoken segments with no intervening transcript
words, observed pause is next first-word start minus preceding last-word end.
Planned pause is the preceding segment's `pause_after`, the following segment's
`pause_before`, and all pauses on intervening silence-only segments. Difference
is observed minus planned seconds. Detected silence overlap is a separate value;
when the interval list is truncated, overlap is unknown rather than understated.
Comparison status is `compared`, not a claim that recording or transcript is
correct.

## Where to plug new thresholds

| Surface | Hook |
| :--- | :--- |
| CLI | `--preset {balanced,developmental,line_editing,conservative_by}`, `--z-mild`, `--z-strong`, `--fdr-q`, `--fdr-method`, `--dim-threshold`, `--flag-min-severity` (explicit flags override `--preset`; see USAGE) |
| API | `api.fingerprint(..., z_mild=…, fdr_q=…, fdr_method=…, …)`, `CorpusConfig.apply_preset(...)` |
| Control UI | Settings group → POST `/api/settings` → `lixity.server.LixityServerHandler` |
| Embedders | `build_dashboard_html(..., z_mild=…, z_strong=…, fdr_q=…, flag_min_severity=…, dim_score_threshold=…)` |
| Config file | Explicit project root: `lixity.toml` or `[tool.lixity]` in `pyproject.toml` |
| Tests | `FingerprintThresholds(...)` + passport `meta` |

Explicit CLI/API options override settings resolved for that call; the native
workspace also has session settings. Root-local project loading and implicit
explicit-file lookup have different boundaries. Use the
[configuration reference](USAGE.md#configuration-corpusconfig) and
[default-manuscript rules](USAGE.md#default-manuscript), not a universal chain
that would mix a browser session with an unrelated CLI process.

## Method currency and recent literature

The lexical-diversity and readability choices follow the current methodological
literature and are re-checked when it changes:

- **Length dependence.** Bestgen's 2024 methodological review confirms that the
  classic length problem of lexical diversity is addressed by length-reducing
  indices, but that the reduction parameter itself becomes a source of
  variance. The review recommends HD-D for an overall score and MATTR/MTLD for
  local trajectories, with a fixed parameter for cross-text comparability.
  Lixity computes HD-D on a 42-token draw — the review's preferred value for
  comparability — reports MTLD and MATTR with fixed windows, and treats
  per-chapter values as short-text estimates. The same review shows that MATTR
  weights tokens by position, which is why Lixity reports it as a local measure
  and keeps HD-D as the corpus-level index.
- **Minimum text lengths.** Koizumi & In'nami (2012) and Zenker & Kyle (2020)
  quantify when lexical-diversity indices stabilise. Lixity states these limits
  in the interface and marks unavailable results instead of hiding them.
- **Measurement noise.** Kyle et al. (2024) evaluate reliability and validity of
  lexical-diversity indices against proficiency scores. Lixity follows the same
  principle with its standard-error approximations (`style_se`) and the
  noise-adjusted deviation `z*` rather than presenting a bare rank.

Adjacent tasks are deliberately out of scope. Authorship attribution and
LLM-generated-text detection are separate research fields with their own
benchmarks and models (Huang et al. 2024; Weerasinghe et al. 2025); their
results depend on the candidate set, the domain and the generator version.
Lixity describes the observable patterns of one manuscript. Every signal stays a
prompt for reading, never a verdict about authorship, quality or machine origin.

<a id="13-acoustic-staging-pacing-and-empirical-reading-rates"></a>
## 14. Audio timing and recording heuristics

Audio controls describe a planned or measured recording; they are not validated
literary pacing metrics. The [audio manual](AUDIO.md) owns operating instructions.

<a id="131-syntactic-pacing-and-target-reading-rates"></a>
### 14.1. Teleprompter speed

The teleprompter starts at 130 WPM and offers a manual 60–240 WPM control.
This value drives approximate scrolling; it is not inferred from chapter ASL,
syntactic complexity or dialogue share. There is no automatic ASL-to-WPM model
in the implemented prompter. It does not listen to the speaker, align speech to
words or set the speech model's speaking rate. Explicit planned pauses and
recording duration remain separate from this reading aid.

<a id="132-acoustic-crest-factor-and-microphone-gain-staging"></a>
### 14.2. Microphone calibration recommendation

The calibration path measures one recorded test window. Its current heuristic
peak band is −13 to −7 dBFS inclusive. Above that band it recommends reducing the
raw mixer setting by 10 steps (lower bound 0); below it, increasing by 6 steps
(upper bound 50). Within the band it keeps the current setting. These are mixer
steps, not a calibrated dB conversion, and the recommendation is not applied
automatically. The implementation uses 35 as a starting value when its gain read
is missing or zero, so the recommendation does not prove the actual hardware gain.

The reported floor is the quietest half-second RMS window, and the reported
peak-to-floor difference is a rough diagnostic, not a measured speech/noise
separation. The band is not a universal optimum, an inter-sample peak guarantee
or a certificate of recording quality. Review clipping, background noise and
intelligibility in the actual take. Browser permission and operating-system
capture access are separate from hardware gain.

References:

- Bestgen, Y. (2024). *Measuring lexical diversity in texts: The twofold length
  problem.* *Language Learning* 74(3), 638–671. doi:10.1111/lang.12630
- Bestgen, Y. (2024). *Estimating lexical diversity using the moving average
  type-token ratio (MATTR): Pros and cons.* (Positional weighting of MATTR.)
- Covington, M. A., & McFall, J. D. (2010). Cutting the Gordian knot: The
  moving-average type-token ratio (MATTR). *Journal of Quantitative
  Linguistics* 17(2), 94–100. doi:10.1080/09296171003643098
- Huang, R., et al. (2024). *Authorship attribution in the era of LLMs:
  Problems, methodologies, and challenges.* arXiv:2408.08946.
- Koizumi, R., & In'nami, Y. (2012). Effects of text length on lexical
  diversity measures. *System* 40(4), 554–564. doi:10.1016/j.system.2012.10.012
- Kyle, K., Sung, H., Eguchi, M., & Zenker, F. (2024). Evaluating evidence for
  the reliability and validity of lexical diversity indices. *Studies in Second
  Language Acquisition* 46(1), 278–299. doi:10.1017/S0272263123000402
- McCarthy, P. M., & Jarvis, S. (2010). MTLD, vocd-D, and HD-D: A validation
  study. *Behavior Research Methods* 42(2), 381–392. doi:10.3758/BRM.42.2.381
- Weerasinghe, J., et al. (2025). Be sure to use the same writing style:
  Applying authorship verification on large-language-model-generated texts.
  *Applied Sciences* 15(5), 2467. doi:10.3390/app15052467
- Zenker, F., & Kyle, K. (2020). Investigating minimum text lengths for lexical
  diversity indices. *Assessing Writing* 47, 100505.
  doi:10.1016/j.asw.2020.100505

## Sensory cues, stratified vocabulary and sentence-length dynamics

Introduced in v0.8.0. These deterministic descriptors support passage review;
they do not estimate literary quality or a reader's experienced immersion.

- `sensory_density = 1000 * sensory_count / token_count`, using the selected
  language's combined sensory regular expression on prose. The lexicons cover
  auditory, visual, haptic/thermal and olfactory/gustatory cues in seven languages.
  `immersion_ratio = sensory_density / filter_density`; a zero filter density
  returns `null`, not an infinite or ideal score. Showing-report means use the
  comparable chapters, omitting unavailable ratios.
- `verb_mattr` and `desc_mattr` apply MATTR to ordered, lowercased token subsets.
  Verb candidates match present/past morphology; descriptive candidates match
  adjective or nominal morphology with nominal exclusions. These are heuristic
  categories, not contextual POS tags. For a category sequence of length N and
  window w, MATTR is the mean of `unique(window) / w` over its N-w+1 windows.
  Fewer than w category tokens returns `null`. The implementation's default
  category window is defined by `DEFAULT_STRATIFIED_WINDOW` in `diversity.py`.
- For sentence token lengths L, `sentence_cv = population_stddev(L) / mean(L)`.
  `compute_rhythm_profile()` (`pacing.py`) also computes `asl_iqr`, three-bucket
  Shannon entropy (`length_entropy`, `normalized_entropy`), and finite-sample
  Goh–Barabási `burstiness()` (Kim & Jo 2016):
  $B_n = \frac{\sqrt{n}(r - 1)}{(\sqrt{n} - 2)r + \sqrt{n}}$ clamped to $[-1, 1]$,
  using sample SD $s$ and $r = s / \bar{x}$. The direct API requires finite
  nonnegative observations and returns `null` for fewer than two observations
  or an all-zero sample. The implementation scales a positive sample by its
  maximum before forming the ratio to keep squared deviations in range.
  Rolling sentence length uses w=N for fewer than six sentences, otherwise
  `w=min(15,max(3,N//3))`. Sliding means are rounded to one decimal and, when
  longer than twelve points, averaged into twelve contiguous index bins.
  `pacing_curve` retains those means; `pacing_sparkline` rescales each chapter's
  own minimum and maximum to eight display levels. A constant curve uses one
  middle level. Empty sentence input has an empty curve and sparkline; its
  current numeric CV sentinel is zero and must not be read as measured regularity.

<a id="revision-time-series-and-session-deltas-unreleased"></a>

## Revision time-series and session deltas

- On every saved edit in `ManuscriptStore.save()` (`manuscript_editing.py`), both
  the pre-edit baseline revision (if not yet recorded) and the resulting
  revision are stored in `manuscript_revisions` inside `recovery.sqlite3`.
- Each revision records deterministic `CorpusAnalyzer` measurements: `words`
  (`clean_words`), `sentences` (`total_sentences`), `asl` (when `sentences > 0`,
  else `null`), `asl_cv` (when `sentences > 0`, else `null`), `dialogue_ratio`
  (when `tokens > 0`, else `null`), `mattr` (when window-eligible, else `null`),
  and per-chapter `{num, title, words, asl, dialog_pct}` snapshots.
- `ManuscriptStore.delta(base_revision, target_revision)` subtracts the
  baseline from the target for comparable measurements. Count differences are
  integers. Decimal differences are rounded to the field's precision. An
  unavailable endpoint yields a `null` difference.
- A default comparison for the latest recorded revision considers the most
  recent 100 entries. It uses the earliest other entry at or before the target
  on the same UTC calendar day, or the preceding entry if none falls on that
  day. A current file outside the recorded history has no implicit baseline.
- When measurement rules or settings differ, Lixity remeasures verified
  retained text under the effective configuration. Automatic language selection
  uses the target to choose a common language. If a comparison cannot be
  established, `has_baseline` is `false` and `deltas` is `null`. The stored
  timeline remains available as recorded and gaps remain visible.

<a id="dramaturgical--structural-heuristics-unreleased"></a>

## Dramaturgical & structural heuristics

- **Sticky sentences & glue-word density (`pacing.py`):** for each prose
  sentence with `N >= sticky_min_words` (default `8`) tokens, glue-word density
  is `glue_pct = 100 * glue_words / N`, where `glue_words` counts lowercased
  tokens present in the active language's `function_words` lexicon. A sentence
  is flagged sticky when `N >= sticky_min_words` and `glue_pct >= sticky_glue_pct`
  (default `45.0`, configurable in `CorpusConfig` on `(0, 100]`). Multiply the
  integer count by 100 before dividing so an intermediate rounding error
  cannot move an exact percentage below the inclusive cutoff. Corpus and
  chapter reports expose `sticky_sentences`, `sticky_sentence_pct`,
  `mean_glue_pct`, `sticky_available` (`false` when the language has no
  `function_words` lexicon, e.g. `generic`), and `sticky_items` (top 50 by
  descending `glue_pct`: `{chapter_num, scene_index, words, glue_words,
  glue_pct, preview}`).
- **Dialogue tag density (`dialogue.py`):** counts speech-attribution verbs
  matching curated per-language inventories (`en`, `de`, `fr`, `es`, `it`,
  `pt`, `nl`; `dialogue_tag_available = false` for `generic`). Per-chapter and
  corpus reports expose `dialogue_tags`,
  `dialogue_tag_pct = min(100.0, 100 * dialogue_tags / turns)` (when `turns > 0`),
  and `dialogue_tags_per_1000 = 1000 * dialogue_tags / words` (when `words > 0`).
- **Scene entry/exit hooks (`pacing.py`, `scenes.py`):** `classify_scene_hook`
  classifies the first (`entry_hook_type`) and last (`exit_hook_type`) non-empty
  prose sentence of each scene as `"dialogue"` (matches `dialogue_re` or begins
  with an opening quote/dash), `"question"` (ends with `?` ignoring trailing
  quotes/brackets), `"reflection"` (matches `filter_verbs_re` or curated
  cognitive/perception cue verbs), `"action"` (fallback for non-empty prose),
  or `"unknown"` (empty). Scenes also expose `exit_hook_score` (`0–3`) and
  `scenes.hook_distribution` (`{"entry": {...}, "exit": {...}}`).
- **POV chapter-absence gaps (`characters.py`, `scenes.py`):** when character
  profiles define `declared_pov_chapters`, `pov_chapters_map` attaches
  `pov_characters` to `scenes.items[]`, and `presence_report` computes per-figure
  `pov_gaps` (`{from_chapter, to_chapter, gap_chapters, missing_chapters}` for
  each contiguous gap between consecutive declared POV chapters),
  `pov_longest_gap`, `pov_leading_gap` (`first_pov - 1`), `pov_trailing_gap`
  (`total_chapters - last_pov`), and `pov_share` (`len(pov_chapters) / total_chapters`,
  rounded to 4 decimals), plus corpus-level `pov_summary`
  (`{declared_figures, pov_coverage_chapters, chapters_without_declared_pov}`).
- **Optional genre reference corridors (`corridors.py`):** `GENRE_CORRIDORS`
  (inspectable at runtime via `lixity.corridors.list_genre_corridors()`)
  defines descriptive orientation bands over `asl`, `dialogue_pct`,
  `staccato_pct`, and `avg_scene_words`:
  - `crime_thriller` (*Crime / Thriller*): `asl` `10.0–16.0`, `dialogue_pct` `25.0–50.0`, `staccato_pct` `15.0–35.0`, `avg_scene_words` `800.0–2200.0`
  - `literary` (*Literary Fiction*): `asl` `14.0–24.0`, `dialogue_pct` `15.0–40.0`, `staccato_pct` `8.0–25.0`, `avg_scene_words` `1200.0–3500.0`
  - `romance` (*Romance*): `asl` `11.0–18.0`, `dialogue_pct` `30.0–55.0`, `staccato_pct` `12.0–30.0`, `avg_scene_words` `1000.0–2800.0`
  - `speculative` (*Speculative / Sci-Fi / Fantasy*): `asl` `13.0–20.0`, `dialogue_pct` `20.0–45.0`, `staccato_pct` `10.0–28.0`, `avg_scene_words` `1200.0–3200.0`
  `evaluate_genre_corridor` sets `non_prescriptive: true` and
  reports each metric's `{observed, low, high, position}` where `position` is
  `"below"`, `"within"`, `"above"`, or `"unavailable"`.
- **Paragraph inline evidence layers (`paragraph_evidence.py`):** each
  paragraph's `evidence[idx]["layers"]` includes four additional deterministic
  annotation layers:
  - `sticky` (`kind: "sentence"`): character spans (`{start, end, count: 1, words}`)
    for sentences with `words >= config.sticky_min_words` and
    `glue_pct >= config.sticky_glue_pct`; returns `status: "unavailable"`,
    `reason: "language_unavailable"` when the language lacks `function_words`.
  - `dialogue_tag` (`kind: "pattern"`): character spans (`{start, end, count: 1}`)
    for speech-attribution verbs adjacent to dialogue quotes; returns
    `status: "unavailable"`, `reason: "language_unavailable"` when the language
    has no dialogue tag verb list.
  - `echo` (`kind: "word"`): character spans (`{start, end, count: 1}`) for
    words of length `>= 4` repeated `>= 2` times in the same paragraph. The
    function-word list excludes matching words where the profile provides one.
  - `indirect_speech` (`kind: "pattern"`): character spans for language-specific
    language-profile cues for reported speech or thought outside detected quotations.
- **Deep dialogue analytics (`dialogue.py`):** `dialogue_report().to_dict()`
  adds:
  - `voice_separation`: compares Spoken Dialogue against Narrative Prose via
    `{available, dialogue_words, narrative_words, dialogue_asl, narrative_asl,
    asl_delta, dialogue_question_excl_pct, narrative_question_excl_pct,
    cosine_similarity, separation_label}` where `separation_label` is
    `"unavailable"` when `dialogue_words == 0` or `narrative_words == 0`,
    `"distinct"` when `cosine_similarity < 0.45` or (`asl_delta` is available
    with `|asl_delta| >= 6.0` and `cosine_similarity < 0.65`), `"moderate"`
    when `cosine_similarity < 0.72`, and `"blended"` otherwise (fixed heuristic
    cutoffs, not calibrated probabilities).
  - `adverbial_tags` (int), `adverbial_tag_pct` (float), and
    `adverbial_tag_available` (bool) at corpus level and per `chapters[]` entry,
    counting speech-attribution tags accompanied by manner adverbs. The
    per-language regex patterns and non-manner exclusion sets
    (`_MANNER_ADVERB_PATTERNS`, `_NON_MANNER_ADVERBS` in `dialogue.py`) are
    curated language-profile implementation details (`en`, `de`, `fr`, `es`,
    `it`, `pt`, `nl`; unavailable for `generic`).
- **Within-scene changes (`scenes.py`):** `scene_report()` keeps `asl_shift`
  and `dialogue_shift` (`float | null`) and the `scene_dynamic` wire values
  `"accelerating"`, `"decelerating"`, `"dialogue_surge"`, `"steady"`, and
  `"insufficient_length"`. The interface describes the measured changes in
  words per sentence and percentage points. See the
  [method cards](#scene-evidence-and-dramaturgical-rehearsal) for the minimum
  sample and the count fields that support the displayed comparisons. The
  scene report also includes `filter_per_1000` and `sensory_per_1000`. In
  `scene_report()`, a word-bearing scene unit with `sentences == 0` reports
  `features.asl = null` (with target position `"unavailable"` and exclusion from
  group baselines), while `CorpusMetrics.asl` and `ChapterMetrics.asl` retain
  their numeric `0.0` schema-2 sentinel. When `_include_draft_evidence=True`,
  `source_sha256` (`scene_source_sha256` in dossier drafts) hashes the scene's
  normalized prose projection (`scene.text`), not raw manuscript bytes. Corpus-level
  `pacing_plateaus` lists `[{start_id, end_id, scene_count, mean_asl, reason}]`
  where `reason` is `"low_exit_hooks"` (`>= 3` consecutive scenes with
  `exit_hook_score <= 1`; `mean_asl` is `null` if no scene in the plateau has a
  measured `features.asl`) or `"flat_pacing"` (`>= 3` `"steady"` scenes of
  `>= 120` words with ASL spread `<= 1.5`).
- **Implicit scene breaks & lexical cohesion drops (`scenes.py`):** `scene_report()`
  exposes top-level `implicit_breaks`: `[{chapter, scene, paragraph_index,
  cue_type, cohesion_similarity, snippet}]`, where `paragraph_index` is 1-based
  within the chapter's prose paragraphs (scanning adjacent paragraphs inside the
  same explicit scene), `cohesion_similarity` is the Jaccard similarity of
  lowercase non-function/non-stopword tokens (`>= 3` characters) across adjacent
  2-paragraph windows inside the scene, and `cue_type` is `"time"`, `"place"`,
  `"character"`, `"cohesion_drop"` (when both windows have `>= 10` content words
  and `cohesion_similarity <= 0.05`), or `+`-joined combinations (e.g.
  `"time+cohesion_drop"`). An implicit `"character"` cue compares disjoint sets
  of recurring capitalized tokens (appearing in `>= 2` paragraphs of the chapter
  outside `_NON_NAME_CAPS` and German article predecessors, or configured
  character names; disabled for unconfigured German prose) between the previous
  paragraph and the opening 60 characters of the current paragraph — it is a
  surface token heuristic, not NER or narrative POV. Descriptive shift markers
  relate to the distinct
  scene-segmentation task studied by [Zehe et al. (2021)](https://aclanthology.org/2021.eacl-main.276/)
  and [Zehe et al. (2025)](https://aclanthology.org/2025.naacl-long.500/).
- **Character voice separation & interaction matrix (`dialogue.py`, `characters.py`):**
  `character_voice_profiles()` (and `presence_report()["character_voices"]`)
  computes `{min_turns: 3, narrator: {words, asl, question_excl_rate,
  function_word_share}, characters: [{name, status, turns, min_turns, words,
  dialogue_asl, question_excl_rate, function_word_share, narrator_asl_delta,
  narrator_question_excl_delta, narrator_function_word_delta}]}`. Rates and
  shares are percentages in `[0, 100]`, and deltas are `character - narrator`.
  Attribution uses deterministic single-speaker adjacent-window matching
  (ambiguous turns are skipped; below `min_turns = 3`, `status` is
  `"insufficient_turns"` with `null` metrics). Both `character_voice_profiles()`
  and `presence_report()` also expose `character_interactions`:
  `{pairs: [{a, b, turn_exchanges, co_chapters}], turn_dominance: [{name, turns,
  words, word_share, turn_share}]}`, where `turn_exchanges` counts adjacent
  attributed turns with different speakers (reset on unattributed turns and
  chapter boundaries) and `co_chapters` counts chapters where both characters
  are mentioned or speak. Motivated by character voice profiling in literary
  dialogue (Michel et al., EMNLP 2024).
- **Rhythm profile & sentence-length entropy (`pacing.py`):** `PacingReport` and
  `ChapterPacing` expose `rhythm_profile`: `{available, sentences, asl_cv,
  asl_iqr, length_entropy, normalized_entropy, bucket_shares}` with
  `bucket_shares: {short, medium, long}`. Short sentences have at most
  `short_sentence_max` words (default `6`). Medium sentences exceed that
  limit and have at most 20 words. Long sentences exceed both limits.
  `asl_cv = std / mean`,
  `asl_iqr = Q75 - Q25`, `length_entropy = -sum(p_b * log2(p_b))` in bits over
  non-empty buckets (max `log2(3) ≈ 1.585` bits), and
  `normalized_entropy = length_entropy / log2(3)`. When `sentences < 2`,
  `available: false` and all numeric metrics are `null`. Tracks sentence-length
  dispersion against narrative flattening (Li et al., 2026; CHR 2024/2025).
- **Indirect speech detection (`paragraph_evidence.py`, `dialogue.py`):**
  `paragraph_evidence.py` adds `layers["indirect_speech"]` (`kind: "pattern"`,
  `ParagraphCounts.indirect_speech`, `status: "available" | "unavailable"`,
  `reason: "language_unavailable"` for `generic`), and `DialogueReport` /
  `DialogueChapter` expose `indirect_speech`, `indirect_speech_per_1000`, and
  `indirect_speech_available`. Matches non-quoted reporting/reflection verbs
  followed by complementizers across all seven supported languages (`en`, `de`,
  `fr`, `es`, `it`, `pt`, `nl`) plus German third-person *Konjunktiv I* and
  reporting-verb-attributed *Konjunktiv II* speech forms (`_INDIRECT_SPEECH_PATTERNS`
  in `dialogue.py`, curated per-language implementation detail; GermAnProse,
  LaTeCH-CLfL 2026; CHR 2024/2025).
- **Enriched revision diff (`manuscript_editing.py`, `cli.py`, `mcp.py`):**
  `analyze_manuscript_snapshot()`, `ManuscriptStore.analyze_snapshot()`,
  `timeline()`, `delta()` (`schema_version: "lixity-timeline/1"`), and
  `compare_texts()` (`schema_version: "lixity-diff/1"`) include
  `length_entropy` (4 decimals), `sticky_pct` (2 decimals), and
  `indirect_speech_per_1000` (2 decimals) alongside `words`, `sentences`, `asl`,
  `asl_cv`, `dialogue_ratio`, `mattr`, `flags_count`, and `chapter_deltas`.
  Exposed via `lixity diff` and the read-only `revision_diff` MCP tool.

### Scene evidence and dramaturgical rehearsal

The scene panel keeps measured text in manuscript order and identifies each
claim using the [evidence ladder](LOCALIZATION.md#evidence-levels-for-analysis-claims).
An explicit divider defines a scene unit. In its absence, the panel identifies
the chapter used as the unit. Counts use the configured word regex and the
shared quotation projection. The method cards below state how to reproduce
the two tracks and their details.

| Level and measure | Formula and scope | Guard and interpretation |
| --- | --- | --- |
| L0 · Quoted-word share | `100 × recognized quoted words / counted words` for the complete unit. The same token membership is used for `features.dialog_pct` and the block detail. | An empty denominator gives an unavailable share. Zero recognized words in a non-empty unit describes the output of the configured recognizer. The track has a fixed 0–100% scale. |
| L0 · Words per sentence | `counted sentence words / counted sentences`, the scene's `features.asl`. Both tracks follow manuscript order. | A zero sentence count in a word-bearing scene unit sets `features.asl` to `null` (target position `"unavailable"`, omitted from register baselines; `CorpusMetrics.asl` and `ChapterMetrics.asl` keep their numeric `0.0` schema-2 sentinel). The track uses a shared panel scale in words per sentence. The measurement describes text length. [Genette, Duration, pp. 86–88](https://utpdistribution.com/9780801410994/narrative-discourse/) |
| L1 · Within-scene change | Split the counted sentences at `floor(n / 2)` in manuscript order. Each half retains `words`, `sentences` and `quote_words` in `within_scene`. Changes are second minus first and are displayed to two decimal places in words per sentence (`asl_shift`) and percentage points (`dialogue_shift`). | A unit needs at least 120 words and two counted sentences. `within_scene_limits` reports the guard and the descriptive cutoffs for the compatibility class (2.5 words per sentence, 15 percentage points). The signed differences describe the two halves. Scene-level standard errors are separate from these descriptive half differences. |
| L2 · Quotation-block lengths | Count positive word lengths of the unioned recognized quotation ranges using the same word membership. `quote_blocks.short` counts lengths ≤ `short_max_words`, `long` counts lengths ≥ `long_min_words`, and `medium` counts lengths strictly between them. `words` totals the counted quoted words. | `quote_block_limits` reports the configured cutoffs, 12 and 80 words by default. `unresolved_ranges` counts unresolved ranges separately. Nested or overlapping recognized marks share a block. Any longer narrative or acoustic unit would need a separate annotation. [Genette, Duration, pp. 86–88](https://utpdistribution.com/9780801410994/narrative-discourse/) |
| L3 · Author intent | An authored card can place a question, delayed answer, turn, revelation or resolution against the text. The author supplies any voice note and effect hypothesis. The card sequence can be rehearsed independently of the measured text. | It is an explicit act of revision planning. **Who has the floor here?** is a reading question. The quote analysis supplies no speaker identity. [Bakhtin, Discourse in the Novel](https://utpress.utexas.edu/9780292715349/) |

For example, two units can each have 96 recognized quoted words among 192
counted words. With the default cutoffs, twelve 8-word blocks and one 96-word
block both produce 50% quoted words. Their L2 distributions differ. Reporting
clauses can interrupt a block, and a quotation can represent a letter or a
cited expression. Fictional elapsed time requires evidence about depicted
events. Questions about the relationship between voices require reading their
context. [Genette (1980), *Narrative Discourse*](https://utpdistribution.com/9780801410994/narrative-discourse/) ·
[Bakhtin (1981), *The Dialogic Imagination*](https://utpress.utexas.edu/9780292715349/)

The order of disclosure matters as a reading question. Fish considers
interpretation as it unfolds, Iser describes a shifting viewpoint, and Jauss
places expectations in the context of prior reading and history. For Lixity,
this motivates showing measures in manuscript order, and letting authors
revisit an intent after revision with the outcome already in mind. Displaying
counts, scope and cutoffs makes the construction of the observations visible.
[Fish (1970), *New Literary History* 2(1), 123–162](https://doi.org/10.2307/468593) ·
[Iser (1978), *The Act of Reading*](https://www.press.jhu.edu/books/title/2456/act-reading) ·
[Jauss (1970), *New Literary History* 2(1), 7–37](https://www.jstor.org/stable/468585) ·
[Drucker (2011), *Digital Humanities Quarterly* 5(1)](https://dhq-static.digitalhumanities.org/pdf/000091.pdf)

Structural-affect and narratological work motivates rehearsing different
orders of disclosure. Hoeken and van Vliet report suspense among readers who
knew the outcome of the story in their experiment. Gerrig's three experiments
recorded disruptions in verifying facts that readers already knew. These
findings remain L4 study evidence. The rehearsal provides an L3 author
hypothesis about the sequence. Reader effects and literary quality are outside
the scene measurements.
[Brewer & Lichtenstein (1982), *Journal of Pragmatics* 6(5–6), 473–486](https://doi.org/10.1016/0378-2166%2882%2990021-2) ·
[Sternberg (1990), *Poetics Today* 11(4), 901–948](https://www.jstor.org/stable/1773082) ·
[Sternberg (1992), *Poetics Today* 13(3), 463–541](https://www.jstor.org/stable/1772872) ·
[Gerrig (1989), *Journal of Memory and Language* 28(6), 633–648](https://doi.org/10.1016/0749-596X%2889%2990001-6) ·
[Hoeken & van Vliet (2000), *Poetics* 27(4), 277–286](https://research-portal.uu.nl/en/publications/suspense-curiosity-and-surprise-how-discourse-structure-influence/)

Modern computational work targets different tasks. CHIRON evaluates rich
character representations through tasks such as masked-character prediction.
The scene-segmentation studies define and evaluate annotated narrative
boundaries. Neither result validates these surface measurements as scene
detectors or speaker attribution. [Gurung & Lapata (2024)](https://aclanthology.org/2024.findings-emnlp.499/) ·
[Zehe et al. (2021)](https://aclanthology.org/2021.eacl-main.276/) ·
[Zehe et al. (2025)](https://aclanthology.org/2025.naacl-long.500/)

#### Exploratory author study proposal

Recruit 8–12 authors for a within-subject usability study. Use three synthetic
fixtures with predefined measurement changes, plus passages from chapter 26 of
*Effi Briest* and chapter 35 of *Pride and Prejudice*. Include an equal-share
pair with different block lengths, a signed within-scene change, and a fixture
with insufficient support or unresolved quotation marks. Freeze the baseline
scene panel at a named revision. Counterbalance condition order and passage
assignment across authors. Record prior familiarity with the public passages
and language proficiency. [Fontane, Project Gutenberg #5323](https://www.gutenberg.org/ebooks/5323) ·
[Austen, Project Gutenberg #1342](https://www.gutenberg.org/ebooks/1342)

| Question | Procedure and outcome |
| --- | --- |
| RQ1 · Locate a measured change | Compare the baseline scene panel with the two-track reading view on matched tasks. Record the first correctly identified passage or boundary, task time and number of text-specific revision questions. Synthetic fixtures supply exact target locations. For published passages, predefine permissible observations and record ambiguities. |
| RQ2 · Formulate a revision question | Compare the scene review task with and without the intent card, holding measured evidence constant. Two raters independently code think-aloud records for a specific passage, a stated intent, and a question the author can check. Record counts, agreement and Cohen's κ per binary criterion when estimable, before adjudicating disagreements. |
| RQ3 · Revisit an intent | After an assigned revision to a synthetic text, ask authors to find the held-over intent, explain its review state, and reopen the relevant passage. Compare previously reviewed and unreviewed states. Record recovery and interpretation accuracy, time and whether the author explicitly confirms after rereading. |

Preregister the materials, assignment, hypotheses, rubric, exclusions and
stopping rule before recruitment. Keep consent, recordings and identifiable
notes outside the repository. Report task completion, missing results and
within-author differences descriptively with the exact sample and limitations.
The outcomes are about using the interface. They exclude reader affect,
literary merit and prose quality. The existing nominal FDR estimates concern
manuscript diagnostics and do not calibrate study outcomes. Research on
foregrounding and engagement uses its own materials and observations.
[Miall & Kuiken (1994), *Poetics* 22(5), 389–407](https://doi.org/10.1016/0304-422X%2894%2900011-5) ·
[Busselle & Bilandzic (2009), *Media Psychology* 12(4)](https://doi.org/10.1080/15213260903287259)

## Manuscript evidence in dossier suggestions

The preview keeps the source and the reason for selection separately.
Character candidates come from configured names or capitalized names that
recur in separate paragraphs of a chapter. Place candidates come from a
configured list or a repeated capitalized expression near a spatial cue, with
at least one directional cue. The inferred place preview gives that
directional passage separately from the first counted name match. Scene
suggestions use explicit separators or the whole chapter and present the
measured opening and closing sentence. Implicit shift cues stay in scene
analysis.

Counts describe the matching rule. A name can refer to different people or
places, while a pronoun or description can refer to the same one. Literary
entity annotation and coreference are separate tasks. The current dossier
generator records the name evidence so authors can resolve such cases in
context. The cited datasets cover English literary text.
[Literary entities](https://aclanthology.org/N19-1220/) ·
[Coreference in English literature](https://aclanthology.org/2020.lrec-1.6/)

For examples and adjustable inference and report settings, see the
[manuscript dossier workflow](research/USAGE.md#manuscript-driven-dossier-drafts).
