Export native speaker hashes from PSIN dialogue turns #1300

Merged
kaoru-maki merged 1 commit from upstream-pr/1300 into main 2026-11-29 00:46:10 +00:00
kaoru-maki commented 2026-11-24 21:32:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kaoru-maki on 2026-11-24T21:32:21Z.


Claimed in the coordination issue as: PSIN-NATIVE-SPEAKER (claim)

What and why

Add text_tables.py --native-speakers to export the character hash selected by each PSIN conversation turn. Resolve the turn's slot within that conversation's participant array and keep the source and record offsets for each occurrence. This covers typed cues outside the AU_ naming pattern and leaves the existing --dialogue CSV compatible with current consumers.

The report leaves the character hash empty for missing, repeated or zero-hash slots. It validates the LSCH layout and bounds typed arrays and strings within their blocks. The native cue and label are sufficient to join on subtitle_hash locally. The report makes no assumption about a cue's wave number or AWC address.

Tested

  • python3 -IB tests/test_psin_dialogue.py, tests/test_text_tables.py, tests/test_psin_data.py and tests/test_psin_index.py (101 passed, 1 skipped).
  • python3 -IB tests/test_docs_cli_flags.py, tests/test_text_write_line_endings.py and tests/test_docs_links.py (23 passed).
  • Local aggregate check on Xbox 1.0.2.1: matched the existing offset, slot and hash references for 7,044 rows across 137 typed PSIN resources that yielded zero pairs under the AU_ expression.
  • git diff --check and scripts/check_no_game_data.py on all changed files.

GPUs tested: n/a (CPU-only, macOS arm64).

AI-assisted: yes.

Checklist

  • Based on the current main and merges cleanly.
  • One topic.
  • Only code, format documentation and synthetic test inputs are included.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5480689593 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1300). Originally posted by [kaoru-maki](https://github.com/kaoru-maki) on 2026-11-24T21:32:21Z. --- Claimed in the coordination issue as: PSIN-NATIVE-SPEAKER ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144955191)) ### What and why Add `text_tables.py --native-speakers` to export the character hash selected by each PSIN conversation turn. Resolve the turn's slot within that conversation's participant array and keep the source and record offsets for each occurrence. This covers typed cues outside the `AU_` naming pattern and leaves the existing `--dialogue` CSV compatible with current consumers. The report leaves the character hash empty for missing, repeated or zero-hash slots. It validates the LSCH layout and bounds typed arrays and strings within their blocks. The native cue and label are sufficient to join on `subtitle_hash` locally. The report makes no assumption about a cue's wave number or AWC address. ### Tested - `python3 -IB tests/test_psin_dialogue.py`, `tests/test_text_tables.py`, `tests/test_psin_data.py` and `tests/test_psin_index.py` (101 passed, 1 skipped). - `python3 -IB tests/test_docs_cli_flags.py`, `tests/test_text_write_line_endings.py` and `tests/test_docs_links.py` (23 passed). - Local aggregate check on Xbox 1.0.2.1: matched the existing offset, slot and hash references for 7,044 rows across 137 typed PSIN resources that yielded zero pairs under the `AU_` expression. - `git diff --check` and `scripts/check_no_game_data.py` on all changed files. GPUs tested: n/a (CPU-only, macOS arm64). AI-assisted: yes. ### Checklist - [x] Based on the current `main` and merges cleanly. - [x] One topic. - [x] Only code, format documentation and synthetic test inputs are included.
kaoru-maki commented 2026-11-24 22:49:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kaoru-maki on 2026-11-24T22:49:12Z.


A follow-up on how we used the native speaker hash. We resolve each PSIN turn's speaker slot in that conversation's participant table, then match the full participant hash to a cast handle in the corresponding scene. The cast record points to the model's asset ID. We resolve the display name through the model's character alias when available, or through the dialogue character registry's GXT key when the model has no alias.

In one confirmed case, two cast members use the same model and both display as Intruder. The turn's slot and the full participant hash distinguish them. We retain separate speaker identities and use the localized text as a display label.

The local census has 66 verified model-to-label mappings. The archive preflight found dialogue slots for 44 of them. Verification of the associated audio is still in progress.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7146681252 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1300#issuecomment-7146681252). Originally posted by [kaoru-maki](https://github.com/kaoru-maki) on 2026-11-24T22:49:12Z. --- A follow-up on how we used the native speaker hash. We resolve each PSIN turn's speaker slot in that conversation's participant table, then match the full participant hash to a cast handle in the corresponding scene. The cast record points to the model's asset ID. We resolve the display name through the model's character alias when available, or through the dialogue character registry's GXT key when the model has no alias. In one confirmed case, two cast members use the same model and both display as `Intruder`. The turn's slot and the full participant hash distinguish them. We retain separate speaker identities and use the localized text as a display label. The local census has 66 verified model-to-label mappings. The archive preflight found dialogue slots for 44 of them. Verification of the associated audio is still in progress.
kaoru-maki commented 2026-11-24 23:46:46 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kaoru-maki on 2026-11-24T23:46:46Z.


The 66-model follow-up is complete. Across 22 archives, we evaluated 18,305 candidate records. We added 6,730 verified subtitle, speaker and original-audio links for 38 characters, covering 5 h 51 min of isolated original speech. Another 4,182 records already had a named match, and 7,393 were held for further evidence in this run.

The PSIN participant hash resolves the turn to a scene cast member. The model or character registry supplies the display label. We use the cue, GXT key and full wave identity to resolve the exact archive stream, then cross-check the text with ASR tied to that isolated original. Separate participant hashes keep their own identities when a model and display label are shared.

In our current catalog snapshot, 32,921 of 42,423 exact subtitle keys have a verified original, or 77.6% of that key set.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7147784836 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1300#issuecomment-7147784836). Originally posted by [kaoru-maki](https://github.com/kaoru-maki) on 2026-11-24T23:46:46Z. --- The 66-model follow-up is complete. Across 22 archives, we evaluated 18,305 candidate records. We added 6,730 verified subtitle, speaker and original-audio links for 38 characters, covering 5 h 51 min of isolated original speech. Another 4,182 records already had a named match, and 7,393 were held for further evidence in this run. The PSIN participant hash resolves the turn to a scene cast member. The model or character registry supplies the display label. We use the cue, GXT key and full wave identity to resolve the exact archive stream, then cross-check the text with ASR tied to that isolated original. Separate participant hashes keep their own identities when a model and display label are shared. In our current catalog snapshot, 32,921 of 42,423 exact subtitle keys have a verified original, or 77.6% of that key set.
kaoru-maki commented 2026-11-25 20:29:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kaoru-maki on 2026-11-25T20:29:22Z.


Here is a synthetic downstream example for the native speaker export. It combines each participant hash and cue key with verified audio ranges. The example preserves event order when a subscene clock resets. It also shows how two participants can share a display label without sharing an identity and how a caption with multiple participants can be flagged for review.

The archive includes five localization tables, a reproducer and results from SixNG v0.9.0. All inputs were generated for this example.

scene-dialogue-fixture-5lang.zip

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7173745526 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1300#issuecomment-7173745526). Originally posted by [kaoru-maki](https://github.com/kaoru-maki) on 2026-11-25T20:29:22Z. --- Here is a synthetic downstream example for the native speaker export. It combines each participant hash and cue key with verified audio ranges. The example preserves event order when a subscene clock resets. It also shows how two participants can share a display label without sharing an identity and how a caption with multiple participants can be flagged for review. The archive includes five localization tables, a reproducer and results from SixNG v0.9.0. All inputs were generated for this example. [scene-dialogue-fixture-5lang.zip](https://github.com/user-attachments/files/35432693/scene-dialogue-fixture-5lang.zip)
kaoru-maki commented 2026-11-25 21:00:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kaoru-maki on 2026-11-25T21:00:59Z.


@ubiquitarianism, could you approve the two GitHub Actions workflows awaiting maintainer approval for this PR so CI can run? Thanks!

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7174494379 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1300#issuecomment-7174494379). Originally posted by [kaoru-maki](https://github.com/kaoru-maki) on 2026-11-25T21:00:59Z. --- @ubiquitarianism, could you approve the two GitHub Actions workflows awaiting maintainer approval for this PR so CI can run? Thanks!
zmasi commented 2026-11-28 20:55:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T20:55:42Z.


#1300 | head 74838ba5f0 (merged cleanly with main 1bc055e6c2) | python -I tests/test_psin_dialogue.py | red on main: ModuleNotFoundError: No module named 'psin_dialogue' (--native-speakers absent on main) | green on PR+main: 5 tests OK | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Audited tools/psin_dialogue.py, tools/text_tables.py, docs/text.md, and tests/test_psin_dialogue.py on Windows 11, verifying LSCH layout validation, bounded _array and _name slicing within typed blocks, conversation-local participant slot lookup (leaving absent/duplicate/zero-hash slots empty), atomic staged --native-speakers CSV output alongside --dialogue (and --native-speakers inclusion in out_flags collision guards), tests/test_docs_encoding.py (1 OK), tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245646714 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1300#issuecomment-7245646714). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T20:55:42Z. --- #1300 | head 74838ba5f097d3af6b20d32f07eb5d0b9a01f333 (merged cleanly with main 1bc055e6c2) | `python -I tests/test_psin_dialogue.py` | red on main: `ModuleNotFoundError: No module named 'psin_dialogue'` (`--native-speakers` absent on `main`) | green on PR+main: `5 tests OK` | Windows 11 (`10.0.26200.9974`), Python 3.12.10 | AI-assisted: yes Audited `tools/psin_dialogue.py`, `tools/text_tables.py`, `docs/text.md`, and `tests/test_psin_dialogue.py` on Windows 11, verifying LSCH layout validation, bounded `_array` and `_name` slicing within typed blocks, conversation-local participant slot lookup (leaving absent/duplicate/zero-hash slots empty), atomic staged `--native-speakers` CSV output alongside `--dialogue` (and `--native-speakers` inclusion in `out_flags` collision guards), `tests/test_docs_encoding.py` (`1 OK`), `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`.
TheGeogeo commented 2026-11-29 00:17:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T00:17:41Z.


Tested 74838ba5f merged (no commit) with main 829530dbd: Python 3.12.4, Windows 11 10.0.26300, CPU only. check_no_game_data.py is clean.

  • Green: tests/test_psin_dialogue.py, 5 tests pass.
  • Red: with tools/psin_dialogue.py and tools/text_tables.py back to main, the test cannot import psin_dialogue (a new tool), so red is only that the module is missing.

No blocker from my side.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248012149 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1300#issuecomment-7248012149). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T00:17:41Z. --- Tested `74838ba5f` merged (no commit) with `main` `829530dbd`: Python 3.12.4, Windows 11 10.0.26300, CPU only. `check_no_game_data.py` is clean. - Green: `tests/test_psin_dialogue.py`, 5 tests pass. - Red: with `tools/psin_dialogue.py` and `tools/text_tables.py` back to `main`, the test cannot import `psin_dialogue` (a new tool), so red is only that the module is missing. No blocker from my side. AI-assisted (Claude Code).
MoonEyes commented 2026-11-29 00:46:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T00:46:13Z.


Merged after TheGeogeo's red/green check (check) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto main 7b70211d1 without conflict, and its test file(s) (tests/test_psin_dialogue.py) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248338403 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1300#issuecomment-7248338403). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T00:46:13Z. --- Merged after **TheGeogeo**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/1300#issuecomment-7248012149)) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto `main` 7b70211d1 without conflict, and its test file(s) (`tests/test_psin_dialogue.py`) pass there. Earlier today the same tests failed on `main` without the PR (red/green) and a bundle with other open PRs showed no new failures. `check_no_game_data.py` is clean. Windows 11, Python 3.14; no GPU needed for these tests. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1300
No description provided.