Add a speaker-review audit: is the attribution data fit for translation?

Runs after a reviewer finishes a book and answers the two questions that
gate the next stage:

  1. Are there utterances with no speaker?
  2. Now that speakers have been defined, renamed, merged or deleted, are
     there utterances that should change?

Read-only - it never edits the database, and a test asserts the files are
byte-identical afterwards. Output is a markdown table and a CSV, one row per
finding with chapter, utterance number and a text preview, so each item is
locatable rather than a count.

Deal Hunter, after the completed review (56 speakers, 0 still needing
review, 4319 utterances):

  - Dialogue with no speaker: 0. The 1803 speakerless rows are narration
    and scene breaks, which is correct and is reported as a number rather
    than silently dropped.
  - Utterances attributed to a deleted speaker: 0.
  - One speaker stored under two spellings: 6 rows across 3 speakers
    (narrator/Narrator, Kainda/Princess Kainda, Willamina Wake/Captain).
    All resolve to one voice so the audio is correct, but a per-speaker
    export would split them into six - caught before the translation stage,
    not after.
  - 6 speech-tag mismatches where the narration immediately before the line
    names a different speaker.
  - 10 dialogue rows voiced by the narrator: 9 are quoted labels ("Reactor.",
    "operations") that are correctly read by the narrator, 1 (ch28 utt46) is
    a real segmentation error. Classified advisory so the one real defect is
    not buried under nine false positives.

build_alias_map moved from scripts/qa_attribution.py into attribution_qa.py
so the CLI and the audit cannot disagree about what a speech tag resolves to;
qa_attribution output verified byte-identical.

13 new tests. Suite: 721 passed, 8 pre-existing.
This commit is contained in:
B.D. Murphy
2026-10-11 21:57:58 -07:00
parent e5bb555e01
commit 9bda553311
5 changed files with 680 additions and 22 deletions

View File

@@ -0,0 +1,94 @@
# Speaker review audit - DealHunterShip_4.0e_whole-to-audio
Generated 2026-10-12 04:57:45Z. Read-only: nothing was modified.
## Summary
- Utterances: **4319** (1874 dialogue)
- Speakers: **56** (116 distinct names + aliases)
- Narration rows with no speaker: **1803** - expected, narration is not spoken by a character
- Findings needing a decision: **12**
## Dialogue still voiced by the narrator (10)
| Chapter | Utt | Severity | Speaker | Expected | Detail |
|---|---|---|---|---|---|
| 10 | 21 | advisory | Narrator | | Dialogue line still attributed to the narrator. |
| 12 | 120 | advisory | Narrator | | Dialogue line still attributed to the narrator. |
| 15 | 122 | advisory | Narrator | | Dialogue line still attributed to the narrator. |
| 15 | 124 | advisory | Narrator | | Dialogue line still attributed to the narrator. |
| 15 | 126 | advisory | Narrator | | Dialogue line still attributed to the narrator. |
| 19 | 116 | advisory | narrator | | Dialogue line still attributed to the narrator. |
| 25 | 178 | advisory | Narrator | | Dialogue line still attributed to the narrator. |
| 25 | 187 | advisory | Narrator | | Dialogue line still attributed to the narrator. |
| 27 | 14 | advisory | Narrator | | Dialogue line still attributed to the narrator. |
| 28 | 46 | advisory | Narrator | | Dialogue line still attributed to the narrator. |
## Narration names a different speaker (6)
| Chapter | Utt | Severity | Speaker | Expected | Detail |
|---|---|---|---|---|---|
| 9 | 21 | action | Kainda Walters Foster Murphy | Duchess Victoria | Nearest tag: 'Vicky says assertively.' |
| 20 | 229 | action | Warbots | The Warbot | Nearest tag: 'The Warbot asks,' |
| 24 | 112 | action | Unnamed Officer | Someone | Nearest tag: 'Someone says,' |
| 25 | 132 | action | Warbots | The Warbot | Nearest tag: 'The Warbot replies in a simple, neutral voice,' |
| 26 | 196 | action | Distorted Voice | Ruler | Nearest tag: 'Ruler says,' |
| 26 | 200 | action | Distorted Voice | Ruler | Nearest tag: 'Ruler replies,' |
## One speaker, several spellings in the database (6)
| Chapter | Utt | Severity | Speaker | Expected | Detail |
|---|---|---|---|---|---|
| - | - | action | Captain | Willamina Wake | 3 utterances stored under this spelling; the same speaker also appears |
| - | - | action | Willamina Wake | Willamina Wake | 21 utterances stored under this spelling; the same speaker also appear |
| - | - | action | Kainda Walters Foster Murphy | Kainda Walters Foster Murphy | 793 utterances stored under this spelling; the same speaker also appea |
| - | - | action | Princess Kainda | Kainda Walters Foster Murphy | 78 utterances stored under this spelling; the same speaker also appear |
| - | - | action | Narrator | Narrator | 15 utterances stored under this spelling; the same speaker also appear |
| - | - | action | narrator | Narrator | 614 utterances stored under this spelling; the same speaker also appea |
## Role tag guessed as a named character (3)
| Chapter | Utt | Severity | Speaker | Expected | Detail |
|---|---|---|---|---|---|
| 6 | 158 | advisory | Kainda Walters Foster Murphy | The Voice | Nearest tag: 'The voice calls again,' |
| 6 | 212 | advisory | Nanny | The Robot | Nearest tag: 'The robot says,' |
| 26 | 152 | advisory | Warbots | The Speaker | Nearest tag: 'Every Warbots lower their weapons, and the speaker says, |
## Narration speaker disagrees (pronoun) (13)
| Chapter | Utt | Severity | Speaker | Expected | Detail |
|---|---|---|---|---|---|
| 10 | 116 | advisory | Brutus | It | Narration names 'It' as speaker |
| 11 | 20 | advisory | Kainda Walters Foster Murphy | She | Narration names 'She' as speaker |
| 17 | 77 | advisory | Kainda Walters Foster Murphy | She | Narration names 'She' as speaker |
| 20 | 123 | advisory | Kainda Walters Foster Murphy | She | Narration names 'She' as speaker |
| 20 | 131 | advisory | Kainda Walters Foster Murphy | She | Narration names 'She' as speaker |
| 20 | 160 | advisory | Kainda Walters Foster Murphy | She | Narration names 'She' as speaker |
| 20 | 174 | advisory | Player Four | He | Narration names 'He' as speaker |
| 25 | 153 | advisory | Kainda Walters Foster Murphy | She | Narration names 'She' as speaker |
| 30 | 84 | advisory | Kainda Walters Foster Murphy | She | Narration names 'She' as speaker |
| 30 | 150 | advisory | Kainda Walters Foster Murphy | She | Narration names 'She' as speaker |
| 30 | 162 | advisory | Kainda Walters Foster Murphy | She | Narration names 'She' as speaker |
| 31 | 12 | advisory | Interrogator | As Kainda | Narration names 'As Kainda' as speaker |
| 32 | 149 | advisory | Kainda Walters Foster Murphy | She | Narration names 'She' as speaker |
## Addressed to the speaker themselves (3)
| Chapter | Utt | Severity | Speaker | Expected | Detail |
|---|---|---|---|---|---|
| 11 | 166 | advisory | Service Robot | | Dialogue addresses 'Service Robot' but speaker is also 'Service Robot' |
| 31 | 109 | advisory | Willamina Wake | | Dialogue addresses 'Willamina Wake' but speaker is also 'Willamina Wak |
| 31 | 111 | advisory | Willamina Wake | | Dialogue addresses 'Willamina Wake' but speaker is also 'Willamina Wak |
---
## Provenance
Generated by `scripts/speaker_review_audit.py`, read-only. Re-run with:
```
python scripts/speaker_review_audit.py --project DealHunterShip_4.0e_whole-to-audio
```
The CSV alongside it in the project (not committed, project dirs are
gitignored) carries one row per finding including the full text preview.