Local, deterministic structural decomposition of speaker-turn transcripts (court transcripts, depositions, interviews, meeting minutes): line-number parsing, speaker-turn grouping, citation-phrase detection, and pattern-based statement classification, emitting an opaque-ID shard with every real name and citation spelling replaced -- the AI never sees the raw prose. Implements the document-structural-decomposition gap named in ADR 0035 (semantic mediation). Pure logic, zero I/O, zero AI calls -- it produces input for a disclosure-minimized AI question, it never asks one itself.
| Tier | domain |
| Role | unclassified (baselined) |
| Path | crates/domain/transcript-shard |
| Edition | 2021 |
| Targets | transcript-shard, domain_transcript_shard |
| Public items | 12 across 0 modules |
| Tests | 11 |
What it is for
Local, deterministic structural decomposition of speaker-turn transcripts: numbered lines -> speaker turns -> pattern-classified statement types -> an opaque-ID shard.
This is the "document structural decomposition" layer named as a real gap in docs/architecture/adr/0035-privacy-preserving-semantic- mediation.md's inventory ("nothing in the inventory parses an arbitrary document into structure in this direction"). Every step here is string parsing and pattern matching -- nothing in this crate calls an AI, makes a network request, or shells out. It produces the minimal disclosure shard a caller would hand to an AI for one narrow question; it never asks that question itself.
Applies to any speaker-turn transcript -- court transcripts, depositions, interviews, meeting minutes -- not only legal proceedings. StatementType's ProceduralCourtesy/ProceduralRuling variants are formal-proceeding-flavored, but the parsing/detection machinery itself is generic (Gate 4.5 AC-generic; Gate 1.5 consensus, docs/userstories/sprint-3.48-transcript-shard.md).
Capabilities
crate root
Local, deterministic structural decomposition of speaker-turn
| Item |
|---|
fn split_speaker_prefix(text : & str) -> Option <(String, String)> |
fn detect_repeated_title_case_phrases(texts : & & str) -> Vec <String> |
RawLine
Local, deterministic structural decomposition of speaker-turn
| Item |
|---|
pub struct RawLine |
fn parse_raw_lines(text : & str) -> Vec <RawLine> |
Shard
Local, deterministic structural decomposition of speaker-turn
| Item |
|---|
pub struct Shard |
fn build_shard(turns : & Turn, task : & str, allowed_outputs : Vec <String>) -> Shard |
StatementRef
Local, deterministic structural decomposition of speaker-turn
| Item |
|---|
pub struct StatementRef |
StatementType
Local, deterministic structural decomposition of speaker-turn
| Item |
|---|
pub enum StatementType |
fn classify_statement(text : & str) -> StatementType |
Turn
Local, deterministic structural decomposition of speaker-turn
| Item |
|---|
pub struct Turn |
fn group_turns(lines : & RawLine) -> Vec <Turn> |
fn detect_citation_phrases(turns : & Turn) -> Vec <String> |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct RawLine | One physical line of the source text: an optional leading line number (the transcript's own numbering) and the text after it |
fn parse_raw_lines(text : & str) -> Vec <RawLine> | Parse raw transcript text into numbered lines |
fn split_speaker_prefix(text : & str) -> Option <(String, String)> | If text starts with an all-uppercase word sequence followed by a colon ("LORD PANNICK:", "THE PRESIDENT:"), split it into (speaker, rest) |
pub struct Turn | One speaker's contiguous turn: who spoke, the transcript line range it spans, and the full text (continuation lines merged with a space) |
fn group_turns(lines : & RawLine) -> Vec <Turn> | Group numbered lines into speaker turns |
pub enum StatementType | A turn's structural type, decided by pattern alone -- no AI |
fn classify_statement(text : & str) -> StatementType | Classify one turn's text |
fn detect_repeated_title_case_phrases(texts : & & str) -> Vec <String> | Find candidate document/case-citation phrases across any set of texts: runs of 2+ consecutive Title-Case words, repeated at least twice across all of them |
fn detect_citation_phrases(turns : & Turn) -> Vec <String> | Same detection, over a transcript's turns specifically -- thin wrapper kept for callers already working with Turns. |
pub struct StatementRef | One statement in the emitted shard: an opaque speaker ID, the opaque document IDs it references, and its structural type |
pub struct Shard | The minimal-disclosure shard: opaque parties, opaque documents, typed statements referencing them, and the fixed question being asked. |
fn build_shard(turns : & Turn, task : & str, allowed_outputs : Vec <String>) -> Shard | Build a shard from turns: detect citation phrases, assign each unique speaker and each citation an opaque ID in first-appearance order, and classify every turn |
No pub use re-exports: every item above is declared in this crate.
Boundary
Reaches into foundation.
Shares tier domain with 41 other crates: domain-agreements, domain-ai-report, domain-billing, domain-catalog, domain-classify, domain-comments, domain-competitive-intel, domain-contact, … (41 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | domain |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/domain/transcript-shard |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_domain["domain"] --> n_foundation["foundation"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `foundation-text-signals` | foundation | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
clap | ^4 | derive | no | always |
serde | ^1 | derive, derive | no | always |
serde_json | ^1 | — | no | always |
Development, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `tools-cli-conformance` | tools | no | always |
Build. None.
Depended on by. 4 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_domain_prose_shard["domain-prose-shard"] -->|uses| SELF n_tools_doc_ask["tools-doc-ask"] -->|uses| SELF n_tools_doc_shape["tools-doc-shape"] -->|uses| SELF n_tools_knowitall["tools-knowitall"] -->|uses| SELF SELF["domain-transcript-shard"] SELF -->|development| n_tools_cli_conformance["tools-cli-conformance"] SELF -->|runtime| n_foundation_text_signals["foundation-text-signals"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| bin | transcript-shard | `src/main.rs` |
| lib | domain_transcript_shard | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
4 workspace crates depend on this one: domain-prose-shard, tools-doc-ask, tools-doc-shape, tools-knowitall.
Verification
| Kind | Count |
|---|---|
| Unit tests | 11 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 12 | 0 | 13 |
What the tests establish, by name:
build_shard_assigns_stable_opaque_ids_and_never_leaks_the_real_citation_spelling—src/lib.rsclassify_statement_matches_every_turn_in_the_real_fixture—src/lib.rsdetect_citation_phrases_finds_de_keyser_and_nothing_else—src/lib.rsdetect_repeated_title_case_phrases_keeps_a_two_word_article_led_proper_name_intact—src/lib.rsdetect_repeated_title_case_phrases_merges_a_sentence_initial_occurrence_with_a_mid_sentence_one—src/lib.rsgroup_turns_merges_continuations_and_tracks_the_real_line_range—src/lib.rsopaque_ids_restart_per_call_not_persisted_across_documents—src/lib.rsparse_raw_lines_reads_leading_numbers_and_keeps_continuation_lines_unnumbered—src/lib.rsreal_ocr_noise_still_produces_the_same_shard_shape_as_the_clean_fixture—src/lib.rssplit_speaker_prefix_recognizes_multi_word_and_rejects_prose—src/lib.rscli_definition_conforms—src/main.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 12 | 12 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 12
"No rustdoc detected" : 0
Metrics
| Metric | Value |
|---|---|
| Rust source files | 2 |
| Source lines | 632 |
| Code lines | 458 |
| Public API items | 12 |
| Public modules | 0 |
| Tests | 11 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 4 |
| Workspace reverse dependencies | 4 |
pie showData
title Public API by kind
"enum" : 1
"function" : 7
"struct" : 4
pie showData
title Rust source composition
"Code" : 458
"Blank or comment" : 174
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.