Text-to-Speech
English
German
voice-acting
qwen3
moss-audio-tokenizer-v2
audio-generation
File size: 2,898 Bytes
88faa07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""Packed per-UID disposition sidecar for the S3 target/transcript audit.

The original worklist and audio stay immutable.  Every audited suspect gets
an explicit disposition, including `verified_keep` for a false-positive flag.
An absent UID is an unaudited clean row and keeps its source text.
"""
from __future__ import annotations

import json
from collections import Counter
from pathlib import Path

import pyarrow.parquet as pq

from build_worklist import EXPECTED_ELIGIBLE, OUT, sha

ROOT = OUT.parent
RESOLUTION_DIR = ROOT / 'target_text_resolution_v1'
RESOLUTION_MANIFEST = RESOLUTION_DIR / 'MANIFEST.json'


def load_resolution():
    spec = json.loads(RESOLUTION_MANIFEST.read_text())
    assert spec['status'] == 'PASS' and spec['version'] == 'hvs-s3-target-text-v1'
    assert spec['source_worklist_sha256'] == sha(OUT / 'MANIFEST.json')
    assert spec['accepted_rows'] + spec['excluded_rows'] == EXPECTED_ELIGIBLE
    assert spec['qa_status'] == 'PASS'
    qa_path = RESOLUTION_DIR / spec['qa_file']
    assert qa_path.parent == RESOLUTION_DIR and sha(qa_path) == spec['qa_sha256']
    qa = json.loads(qa_path.read_text())
    assert qa['status'] == 'PASS' and qa['sampled_rows'] >= 128
    render_path = RESOLUTION_DIR / spec['render_qa_file']
    assert render_path.parent == RESOLUTION_DIR and sha(render_path) == spec['render_qa_sha256']
    render_qa = json.loads(render_path.read_text())
    assert render_qa['status'] == 'PASS' and render_qa['sampled_rows'] >= 128
    assert spec['unresolved_impossible_rows'] == 0
    assert spec['audit_report_sha256'] == sha(ROOT / 'target_text_audit_v1' / 'REPORT.json')
    path = RESOLUTION_DIR / spec['changes_file']
    assert path.parent == RESOLUTION_DIR and sha(path) == spec['changes_sha256']
    rows = pq.read_table(path, columns=['uid', 'action', 'text']).to_pylist()
    assert len(rows) == spec['changed_rows']
    changes = {}
    actions = Counter()
    for row in rows:
        uid, action, text = row['uid'], row['action'], row['text']
        assert uid and uid not in changes
        assert action in ('relabel', 'burst_only', 'exclude', 'verified_keep')
        actions[action] += 1
        if action in ('exclude', 'verified_keep'):
            assert not text
        else:
            assert text and text.strip()
        changes[uid] = (action, text)
    assert actions['exclude'] == spec['excluded_rows']
    assert dict(actions) == spec['action_rows']
    return spec, changes


def apply_to_rows(rows, changes):
    kept = []
    for row in rows:
        change = changes.get(row['uid'])
        if change is None:
            kept.append(row)
        elif change[0] == 'verified_keep':
            kept.append(row)
        elif change[0] in ('relabel', 'burst_only'):
            row['_resolved_text'] = change[1]
            row['_resolution_action'] = change[0]
            kept.append(row)
    return kept