Datasets:

Modalities:
Text
Formats:
json
Languages:
Japanese
ArXiv:
License:
sabizushi commited on
Commit
e60cb55
·
0 Parent(s):

asr-ja-bench v1.1: sample lists, corrections, hashes and rebuild script

Browse files
.gitattributes ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.avro filter=lfs diff=lfs merge=lfs -text
4
+ *.bin filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
7
+ *.ftz filter=lfs diff=lfs merge=lfs -text
8
+ *.gz filter=lfs diff=lfs merge=lfs -text
9
+ *.h5 filter=lfs diff=lfs merge=lfs -text
10
+ *.joblib filter=lfs diff=lfs merge=lfs -text
11
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
13
+ *.mds filter=lfs diff=lfs merge=lfs -text
14
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
15
+ *.model filter=lfs diff=lfs merge=lfs -text
16
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
17
+ *.npy filter=lfs diff=lfs merge=lfs -text
18
+ *.npz filter=lfs diff=lfs merge=lfs -text
19
+ *.onnx filter=lfs diff=lfs merge=lfs -text
20
+ *.ot filter=lfs diff=lfs merge=lfs -text
21
+ *.parquet filter=lfs diff=lfs merge=lfs -text
22
+ *.pb filter=lfs diff=lfs merge=lfs -text
23
+ *.pickle filter=lfs diff=lfs merge=lfs -text
24
+ *.pkl filter=lfs diff=lfs merge=lfs -text
25
+ *.pt filter=lfs diff=lfs merge=lfs -text
26
+ *.pth filter=lfs diff=lfs merge=lfs -text
27
+ *.rar filter=lfs diff=lfs merge=lfs -text
28
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
29
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
31
+ *.tar filter=lfs diff=lfs merge=lfs -text
32
+ *.tflite filter=lfs diff=lfs merge=lfs -text
33
+ *.tgz filter=lfs diff=lfs merge=lfs -text
34
+ *.wasm filter=lfs diff=lfs merge=lfs -text
35
+ *.xz filter=lfs diff=lfs merge=lfs -text
36
+ *.zip filter=lfs diff=lfs merge=lfs -text
37
+ *.zst filter=lfs diff=lfs merge=lfs -text
38
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
39
+ # Audio files - uncompressed
40
+ *.pcm filter=lfs diff=lfs merge=lfs -text
41
+ *.sam filter=lfs diff=lfs merge=lfs -text
42
+ *.raw filter=lfs diff=lfs merge=lfs -text
43
+ # Audio files - compressed
44
+ *.aac filter=lfs diff=lfs merge=lfs -text
45
+ *.flac filter=lfs diff=lfs merge=lfs -text
46
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
47
+ *.ogg filter=lfs diff=lfs merge=lfs -text
48
+ *.wav filter=lfs diff=lfs merge=lfs -text
49
+ # Image files - uncompressed
50
+ *.bmp filter=lfs diff=lfs merge=lfs -text
51
+ *.gif filter=lfs diff=lfs merge=lfs -text
52
+ *.png filter=lfs diff=lfs merge=lfs -text
53
+ *.tiff filter=lfs diff=lfs merge=lfs -text
54
+ # Image files - compressed
55
+ *.jpg filter=lfs diff=lfs merge=lfs -text
56
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
57
+ *.webp filter=lfs diff=lfs merge=lfs -text
58
+ # Video files - compressed
59
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
60
+ *.webm filter=lfs diff=lfs merge=lfs -text
LICENSE.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Licences
2
+
3
+ asr-ja-bench combines material under different licences:
4
+
5
+ - `rebuild.py` and `README.md` are licensed under Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0).
6
+ - Each `data/<subset>/` folder is derived from its source dataset and is licensed under that dataset's licence, as listed below.
7
+
8
+ | path | source dataset | licence |
9
+ |---|---|---|
10
+ | `data/jsut/` | JSUT basic5000 | CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/) |
11
+ | `data/jvnv/` | JVNV | CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/) |
12
+ | `data/tedxjp10k/` | TEDxJP-10K | Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0) |
13
+ | `data/fleurs/` | FLEURS (ja_jp, test) | CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) |
14
+ | `data/speech-bsd/` | SpeechBSD (ja, test) | CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/) |
15
+
16
+ The audio and transcripts of the source datasets are not included. Obtaining and using them is subject to each dataset's own terms.
README.md ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ja
4
+ task_categories:
5
+ - automatic-speech-recognition
6
+ pretty_name: asr-ja-bench
7
+ license: other
8
+ license_name: per-subset
9
+ license_link: LICENSE.md
10
+ configs:
11
+ - config_name: jsut
12
+ default: true
13
+ data_files:
14
+ - split: test
15
+ path: data/jsut/samples.jsonl
16
+ - config_name: jvnv
17
+ data_files:
18
+ - split: test
19
+ path: data/jvnv/samples.jsonl
20
+ - config_name: tedxjp10k
21
+ data_files:
22
+ - split: test
23
+ path: data/tedxjp10k/samples.jsonl
24
+ - config_name: fleurs
25
+ data_files:
26
+ - split: test
27
+ path: data/fleurs/samples.jsonl
28
+ - config_name: speech-bsd
29
+ data_files:
30
+ - split: test
31
+ path: data/speech-bsd/samples.jsonl
32
+ ---
33
+
34
+ # asr-ja-bench
35
+
36
+ A Japanese speech recognition benchmark built from five public test sets: [JSUT](https://sites.google.com/site/shinnosuketakamichi/publication/jsut), [JVNV](https://sites.google.com/site/shinnosuketakamichi/research-topics/jvnv_corpus), [TEDxJP-10K](https://github.com/laboroai/TEDxJP-10K), [FLEURS](https://huggingface.co/datasets/google/fleurs) and [SpeechBSD](https://github.com/ku-nlp/speechBSD), with known label defects corrected or the samples removed. The [Haas-ja-v1.0](https://huggingface.co/third-intelligence/Haas-ja-v1.0) results are reported on it.
37
+
38
+ This repository contains **no audio and no transcripts**: the upstream corpora have different licences, and several do not allow redistribution. It lists which upstream samples the benchmark uses, the corrections made to their transcripts, and hashes to verify them. [`rebuild.py`](rebuild.py) recreates the benchmark from the upstream corpora and checks every transcript against its hash.
39
+
40
+ **Version: v1.1.** Report results with the version they were measured on.
41
+
42
+ | subset | upstream | samples | hours |
43
+ |---|---|---:|---:|
44
+ | `jsut` | JSUT basic5000 | 5,000 | 6.78 |
45
+ | `jvnv` | JVNV | 1,375 | 3.33 |
46
+ | `tedxjp10k` | TEDxJP-10K | 9,200 | 8.21 |
47
+ | `fleurs` | FLEURS (ja_jp, test) | 650 | 2.36 |
48
+ | `speech-bsd` | SpeechBSD (ja, test) | 2,093 | 2.70 |
49
+ | **total** | | **18,318** | **23.38** |
50
+
51
+ ## Differences from the upstream test sets
52
+
53
+ | subset | upstream samples | not included (scope rule) | removed (label defect) | transcripts corrected | samples |
54
+ |---|---:|---:|---:|---:|---:|
55
+ | `jsut` | 5,000 | 0 | 0 | 3 | 5,000 |
56
+ | `jvnv` | 1,615 | 240 | 0 | 0 | 1,375 |
57
+ | `tedxjp10k` | 10,000 (9,233 reconstructed¹) | 10 | 23 | 13 | 9,200 |
58
+ | `fleurs` | 650 | 0 | 0 | 2 | 650 |
59
+ | `speech-bsd` | 2,120 | 1 | 26 | 23 | 2,093 |
60
+
61
+ ¹ TEDxJP-10K is reconstructed from YouTube. When this benchmark was built, 767 of its 10,000 utterances could no longer be recovered (videos or subtitles removed), so it uses the remaining ones.
62
+
63
+ Why samples were removed (`excluded.jsonl`, field `reason`):
64
+
65
+ - `out_of_scope`: JVNV's phrase-free session (`*_free_*`): its non-verbal vocalizations are improvised and have no transcript.
66
+ - `label_too_long`: the transcript is longer than 15 characters per second of audio.
67
+ - `wrong_audio`: the audio does not contain the transcribed utterance.
68
+ - `no_speech`: the audio contains no speech.
69
+
70
+ Corrected transcripts fix errors heard in the audio. In JSUT, two transcripts belonged to the neighbouring file, and one repeated a word.
71
+
72
+ SpeechBSD transcripts were also normalized when the benchmark was built: full-width characters folded to half-width (NFKC), Latin letters lowercased, and 「」, ・ and spaces removed (540 samples). These changes are in the patches too, so a rebuild reproduces the benchmark exactly.
73
+
74
+ ## Files
75
+
76
+ ```
77
+ data/<subset>/samples.jsonl the benchmark's samples, in order
78
+ data/<subset>/excluded.jsonl upstream samples removed, with the reason
79
+ rebuild.py upstream corpora -> the benchmark
80
+ LICENSE.md which licence applies where
81
+ ```
82
+
83
+ Each line of `samples.jsonl`:
84
+
85
+ | field | |
86
+ |---|---|
87
+ | `id` | the upstream sample id: JSUT `BASIC5000_0001`, JVNV `F1_anger_regular_01`, the TEDxJP-10K utterance id, the FLEURS recording's file name without `.wav`, the SpeechBSD `ja_wav` stem |
88
+ | `duration` | seconds of 16 kHz audio |
89
+ | `upstream_sha256` | SHA-256 of the upstream transcript (UTF-8) |
90
+ | `text_sha256` | SHA-256 of the benchmark transcript |
91
+ | `patch` | only if the transcript was changed: `[[start, end, replacement], ...]`, code-point offsets into the upstream transcript, applied from the right. It holds only the replacement characters, never the upstream text. |
92
+
93
+ ## Rebuilding
94
+
95
+ Get the upstream corpora:
96
+
97
+ - **JSUT basic5000**: `jsut_ver1.1.zip` from the [JSUT page](https://sites.google.com/site/shinnosuketakamichi/publication/jsut) (pass the zip or its extracted directory as `--jsut`).
98
+ - **JVNV**: `jvnv_ver1.zip` from the [JVNV page](https://sites.google.com/site/shinnosuketakamichi/research-topics/jvnv_corpus) (`--jvnv`).
99
+ - **TEDxJP-10K**: Reconstruct TEDxJP-10K v1.1 with the [TEDxJP-10K repository](https://github.com/laboroai/TEDxJP-10K)'s instructions (download the listed YouTube videos and subtitles, run `compose_tedxjp10k.py`) and pass the resulting `TEDxJP-10K_v1.1` directory as `--tedxjp10k`. Videos and subtitles removed from YouTube cannot be recovered, so a reconstruction can have fewer utterances; `rebuild.py` lists any sample it cannot find.
100
+ - **FLEURS (ja_jp, test)**: Read from the Hub (`google/fleurs`, `ja_jp`, pinned revision) by `rebuild.py`.
101
+ - **SpeechBSD (ja, test)**: Read from the Hub (`ku-nlp/speech-bsd-hf`, pinned revision) by `rebuild.py`. The repository is gated: accept its terms on the Hub and log in (`hf auth login`) first.
102
+
103
+ Then:
104
+
105
+ ```bash
106
+ pip install numpy soundfile pyarrow huggingface_hub # and ffmpeg on PATH
107
+ python rebuild.py --jsut jsut_ver1.1.zip --jvnv jvnv_ver1.zip \
108
+ --tedxjp10k TEDxJP-10K_v1.1 --out asr-ja-bench-v1.1
109
+ ```
110
+
111
+ This writes the benchmark data directory `asr-ja-bench-v1.1/`: `<subset>.jsonl` (`id`, `audio`, `text`, `duration`) and the audio as 16 kHz mono 16-bit FLAC. It is separate from this repository's own folder, which holds only the sample lists. `--subset` limits it to some subsets, and `--text-only` checks the transcripts without writing audio. It exits with an error if a transcript does not match its hash or a sample is missing.
112
+
113
+ Transcripts are reproduced exactly. JSUT and JVNV are recorded at 48 kHz and are resampled to 16 kHz with ffmpeg's default resampler, which reproduces the benchmark audio bit for bit (tested with ffmpeg 7.1). FLEURS and SpeechBSD audio is used as is. TEDxJP-10K audio is whatever its reconstruction produces; reconstructions can differ by a few least-significant bits, because the upstream script converts the audio with sox, which dithers.
114
+
115
+ ## Licences
116
+
117
+ Each `data/<subset>/` folder is derived from its source dataset and licensed under that dataset's licence, listed below; `rebuild.py` and this card are Apache-2.0 (see [`LICENSE.md`](LICENSE.md)). The audio and transcripts are not included: obtaining and using them is subject to each corpus's own terms.
118
+
119
+ | subset | licence of `data/<subset>/` |
120
+ |---|---|
121
+ | `jsut` | [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) |
122
+ | `jvnv` | [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) |
123
+ | `tedxjp10k` | [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) |
124
+ | `fleurs` | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) |
125
+ | `speech-bsd` | [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) |
126
+
127
+ ## Acknowledgements
128
+
129
+ We thank the authors of JSUT, JVNV, TEDxJP-10K, FLEURS and SpeechBSD for creating these corpora and making them openly available. If you use asr-ja-bench, please also cite them:
130
+
131
+ - **JSUT** ([page](https://sites.google.com/site/shinnosuketakamichi/publication/jsut)): Sonobe, R., Takamichi, S., & Saruwatari, H. (2017). JSUT corpus: Free large-scale Japanese speech corpus for end-to-end speech synthesis. *arXiv preprint arXiv:1711.00354*.
132
+ - **JVNV** ([page](https://sites.google.com/site/shinnosuketakamichi/research-topics/jvnv_corpus)): Xin, D., Jiang, J., Takamichi, S., Saito, Y., Aizawa, A., & Saruwatari, H. (2023). JVNV: A corpus of Japanese emotional speech with verbal content and nonverbal expressions. *arXiv preprint arXiv:2310.06072*.
133
+ - **TEDxJP-10K** ([repository](https://github.com/laboroai/TEDxJP-10K)): 安藤慎太郎, 藤原弘将 (2020). テレビ録画とその字幕を利用した大規模日本語音声コーパスの構築. *情報処理学会研究報告*, Vol.2020-SLP-134, No.8.
134
+ - **FLEURS** ([dataset](https://huggingface.co/datasets/google/fleurs)): Conneau, A., Ma, M., Khanuja, S., Zhang, Y., Axelrod, V., Dalmia, S., Riesa, J., Rivera, C., & Bapna, A. (2022). FLEURS: Few-shot learning evaluation of universal representations of speech. *arXiv preprint arXiv:2205.12446*.
135
+ - **SpeechBSD** ([repository](https://github.com/ku-nlp/speechBSD)): Shimizu, S., Chu, C., Li, S., & Kurohashi, S. (2023). Towards speech dialogue translation mediating speakers of different languages. In *Findings of the Association for Computational Linguistics: ACL 2023* (pp. 1122–1134). Association for Computational Linguistics. https://aclanthology.org/2023.findings-acl.72
data/fleurs/excluded.jsonl ADDED
File without changes
data/fleurs/samples.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/jsut/excluded.jsonl ADDED
File without changes
data/jsut/samples.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/jvnv/excluded.jsonl ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"id": "F1_anger_free_01", "reason": "out_of_scope"}
2
+ {"id": "F1_anger_free_02", "reason": "out_of_scope"}
3
+ {"id": "F1_anger_free_03", "reason": "out_of_scope"}
4
+ {"id": "F1_anger_free_04", "reason": "out_of_scope"}
5
+ {"id": "F1_anger_free_05", "reason": "out_of_scope"}
6
+ {"id": "F1_anger_free_06", "reason": "out_of_scope"}
7
+ {"id": "F1_anger_free_07", "reason": "out_of_scope"}
8
+ {"id": "F1_anger_free_08", "reason": "out_of_scope"}
9
+ {"id": "F1_anger_free_09", "reason": "out_of_scope"}
10
+ {"id": "F1_anger_free_10", "reason": "out_of_scope"}
11
+ {"id": "F1_disgust_free_01", "reason": "out_of_scope"}
12
+ {"id": "F1_disgust_free_02", "reason": "out_of_scope"}
13
+ {"id": "F1_disgust_free_03", "reason": "out_of_scope"}
14
+ {"id": "F1_disgust_free_04", "reason": "out_of_scope"}
15
+ {"id": "F1_disgust_free_05", "reason": "out_of_scope"}
16
+ {"id": "F1_disgust_free_06", "reason": "out_of_scope"}
17
+ {"id": "F1_disgust_free_07", "reason": "out_of_scope"}
18
+ {"id": "F1_disgust_free_08", "reason": "out_of_scope"}
19
+ {"id": "F1_disgust_free_09", "reason": "out_of_scope"}
20
+ {"id": "F1_disgust_free_10", "reason": "out_of_scope"}
21
+ {"id": "F1_fear_free_01", "reason": "out_of_scope"}
22
+ {"id": "F1_fear_free_02", "reason": "out_of_scope"}
23
+ {"id": "F1_fear_free_03", "reason": "out_of_scope"}
24
+ {"id": "F1_fear_free_04", "reason": "out_of_scope"}
25
+ {"id": "F1_fear_free_05", "reason": "out_of_scope"}
26
+ {"id": "F1_fear_free_06", "reason": "out_of_scope"}
27
+ {"id": "F1_fear_free_07", "reason": "out_of_scope"}
28
+ {"id": "F1_fear_free_08", "reason": "out_of_scope"}
29
+ {"id": "F1_fear_free_09", "reason": "out_of_scope"}
30
+ {"id": "F1_fear_free_10", "reason": "out_of_scope"}
31
+ {"id": "F1_happy_free_01", "reason": "out_of_scope"}
32
+ {"id": "F1_happy_free_02", "reason": "out_of_scope"}
33
+ {"id": "F1_happy_free_03", "reason": "out_of_scope"}
34
+ {"id": "F1_happy_free_04", "reason": "out_of_scope"}
35
+ {"id": "F1_happy_free_05", "reason": "out_of_scope"}
36
+ {"id": "F1_happy_free_06", "reason": "out_of_scope"}
37
+ {"id": "F1_happy_free_07", "reason": "out_of_scope"}
38
+ {"id": "F1_happy_free_08", "reason": "out_of_scope"}
39
+ {"id": "F1_happy_free_09", "reason": "out_of_scope"}
40
+ {"id": "F1_happy_free_10", "reason": "out_of_scope"}
41
+ {"id": "F1_sad_free_01", "reason": "out_of_scope"}
42
+ {"id": "F1_sad_free_02", "reason": "out_of_scope"}
43
+ {"id": "F1_sad_free_03", "reason": "out_of_scope"}
44
+ {"id": "F1_sad_free_04", "reason": "out_of_scope"}
45
+ {"id": "F1_sad_free_05", "reason": "out_of_scope"}
46
+ {"id": "F1_sad_free_06", "reason": "out_of_scope"}
47
+ {"id": "F1_sad_free_07", "reason": "out_of_scope"}
48
+ {"id": "F1_sad_free_08", "reason": "out_of_scope"}
49
+ {"id": "F1_sad_free_09", "reason": "out_of_scope"}
50
+ {"id": "F1_sad_free_10", "reason": "out_of_scope"}
51
+ {"id": "F1_surprise_free_01", "reason": "out_of_scope"}
52
+ {"id": "F1_surprise_free_02", "reason": "out_of_scope"}
53
+ {"id": "F1_surprise_free_03", "reason": "out_of_scope"}
54
+ {"id": "F1_surprise_free_04", "reason": "out_of_scope"}
55
+ {"id": "F1_surprise_free_05", "reason": "out_of_scope"}
56
+ {"id": "F1_surprise_free_06", "reason": "out_of_scope"}
57
+ {"id": "F1_surprise_free_07", "reason": "out_of_scope"}
58
+ {"id": "F1_surprise_free_08", "reason": "out_of_scope"}
59
+ {"id": "F1_surprise_free_09", "reason": "out_of_scope"}
60
+ {"id": "F1_surprise_free_10", "reason": "out_of_scope"}
61
+ {"id": "F2_anger_free_01", "reason": "out_of_scope"}
62
+ {"id": "F2_anger_free_02", "reason": "out_of_scope"}
63
+ {"id": "F2_anger_free_03", "reason": "out_of_scope"}
64
+ {"id": "F2_anger_free_04", "reason": "out_of_scope"}
65
+ {"id": "F2_anger_free_05", "reason": "out_of_scope"}
66
+ {"id": "F2_anger_free_06", "reason": "out_of_scope"}
67
+ {"id": "F2_anger_free_07", "reason": "out_of_scope"}
68
+ {"id": "F2_anger_free_08", "reason": "out_of_scope"}
69
+ {"id": "F2_anger_free_09", "reason": "out_of_scope"}
70
+ {"id": "F2_anger_free_10", "reason": "out_of_scope"}
71
+ {"id": "F2_disgust_free_01", "reason": "out_of_scope"}
72
+ {"id": "F2_disgust_free_02", "reason": "out_of_scope"}
73
+ {"id": "F2_disgust_free_03", "reason": "out_of_scope"}
74
+ {"id": "F2_disgust_free_04", "reason": "out_of_scope"}
75
+ {"id": "F2_disgust_free_05", "reason": "out_of_scope"}
76
+ {"id": "F2_disgust_free_06", "reason": "out_of_scope"}
77
+ {"id": "F2_disgust_free_07", "reason": "out_of_scope"}
78
+ {"id": "F2_disgust_free_08", "reason": "out_of_scope"}
79
+ {"id": "F2_disgust_free_09", "reason": "out_of_scope"}
80
+ {"id": "F2_disgust_free_10", "reason": "out_of_scope"}
81
+ {"id": "F2_fear_free_01", "reason": "out_of_scope"}
82
+ {"id": "F2_fear_free_02", "reason": "out_of_scope"}
83
+ {"id": "F2_fear_free_03", "reason": "out_of_scope"}
84
+ {"id": "F2_fear_free_04", "reason": "out_of_scope"}
85
+ {"id": "F2_fear_free_05", "reason": "out_of_scope"}
86
+ {"id": "F2_fear_free_06", "reason": "out_of_scope"}
87
+ {"id": "F2_fear_free_07", "reason": "out_of_scope"}
88
+ {"id": "F2_fear_free_08", "reason": "out_of_scope"}
89
+ {"id": "F2_fear_free_09", "reason": "out_of_scope"}
90
+ {"id": "F2_fear_free_10", "reason": "out_of_scope"}
91
+ {"id": "F2_happy_free_01", "reason": "out_of_scope"}
92
+ {"id": "F2_happy_free_02", "reason": "out_of_scope"}
93
+ {"id": "F2_happy_free_03", "reason": "out_of_scope"}
94
+ {"id": "F2_happy_free_04", "reason": "out_of_scope"}
95
+ {"id": "F2_happy_free_05", "reason": "out_of_scope"}
96
+ {"id": "F2_happy_free_06", "reason": "out_of_scope"}
97
+ {"id": "F2_happy_free_07", "reason": "out_of_scope"}
98
+ {"id": "F2_happy_free_08", "reason": "out_of_scope"}
99
+ {"id": "F2_happy_free_09", "reason": "out_of_scope"}
100
+ {"id": "F2_happy_free_10", "reason": "out_of_scope"}
101
+ {"id": "F2_sad_free_01", "reason": "out_of_scope"}
102
+ {"id": "F2_sad_free_02", "reason": "out_of_scope"}
103
+ {"id": "F2_sad_free_03", "reason": "out_of_scope"}
104
+ {"id": "F2_sad_free_04", "reason": "out_of_scope"}
105
+ {"id": "F2_sad_free_05", "reason": "out_of_scope"}
106
+ {"id": "F2_sad_free_06", "reason": "out_of_scope"}
107
+ {"id": "F2_sad_free_07", "reason": "out_of_scope"}
108
+ {"id": "F2_sad_free_08", "reason": "out_of_scope"}
109
+ {"id": "F2_sad_free_09", "reason": "out_of_scope"}
110
+ {"id": "F2_sad_free_10", "reason": "out_of_scope"}
111
+ {"id": "F2_surprise_free_01", "reason": "out_of_scope"}
112
+ {"id": "F2_surprise_free_02", "reason": "out_of_scope"}
113
+ {"id": "F2_surprise_free_03", "reason": "out_of_scope"}
114
+ {"id": "F2_surprise_free_04", "reason": "out_of_scope"}
115
+ {"id": "F2_surprise_free_05", "reason": "out_of_scope"}
116
+ {"id": "F2_surprise_free_06", "reason": "out_of_scope"}
117
+ {"id": "F2_surprise_free_07", "reason": "out_of_scope"}
118
+ {"id": "F2_surprise_free_08", "reason": "out_of_scope"}
119
+ {"id": "F2_surprise_free_09", "reason": "out_of_scope"}
120
+ {"id": "F2_surprise_free_10", "reason": "out_of_scope"}
121
+ {"id": "M1_anger_free_01", "reason": "out_of_scope"}
122
+ {"id": "M1_anger_free_02", "reason": "out_of_scope"}
123
+ {"id": "M1_anger_free_03", "reason": "out_of_scope"}
124
+ {"id": "M1_anger_free_04", "reason": "out_of_scope"}
125
+ {"id": "M1_anger_free_05", "reason": "out_of_scope"}
126
+ {"id": "M1_anger_free_06", "reason": "out_of_scope"}
127
+ {"id": "M1_anger_free_07", "reason": "out_of_scope"}
128
+ {"id": "M1_anger_free_08", "reason": "out_of_scope"}
129
+ {"id": "M1_anger_free_09", "reason": "out_of_scope"}
130
+ {"id": "M1_anger_free_10", "reason": "out_of_scope"}
131
+ {"id": "M1_disgust_free_01", "reason": "out_of_scope"}
132
+ {"id": "M1_disgust_free_02", "reason": "out_of_scope"}
133
+ {"id": "M1_disgust_free_03", "reason": "out_of_scope"}
134
+ {"id": "M1_disgust_free_04", "reason": "out_of_scope"}
135
+ {"id": "M1_disgust_free_05", "reason": "out_of_scope"}
136
+ {"id": "M1_disgust_free_06", "reason": "out_of_scope"}
137
+ {"id": "M1_disgust_free_07", "reason": "out_of_scope"}
138
+ {"id": "M1_disgust_free_08", "reason": "out_of_scope"}
139
+ {"id": "M1_disgust_free_09", "reason": "out_of_scope"}
140
+ {"id": "M1_disgust_free_10", "reason": "out_of_scope"}
141
+ {"id": "M1_fear_free_01", "reason": "out_of_scope"}
142
+ {"id": "M1_fear_free_02", "reason": "out_of_scope"}
143
+ {"id": "M1_fear_free_03", "reason": "out_of_scope"}
144
+ {"id": "M1_fear_free_04", "reason": "out_of_scope"}
145
+ {"id": "M1_fear_free_05", "reason": "out_of_scope"}
146
+ {"id": "M1_fear_free_06", "reason": "out_of_scope"}
147
+ {"id": "M1_fear_free_07", "reason": "out_of_scope"}
148
+ {"id": "M1_fear_free_08", "reason": "out_of_scope"}
149
+ {"id": "M1_fear_free_09", "reason": "out_of_scope"}
150
+ {"id": "M1_fear_free_10", "reason": "out_of_scope"}
151
+ {"id": "M1_happy_free_01", "reason": "out_of_scope"}
152
+ {"id": "M1_happy_free_02", "reason": "out_of_scope"}
153
+ {"id": "M1_happy_free_03", "reason": "out_of_scope"}
154
+ {"id": "M1_happy_free_04", "reason": "out_of_scope"}
155
+ {"id": "M1_happy_free_05", "reason": "out_of_scope"}
156
+ {"id": "M1_happy_free_06", "reason": "out_of_scope"}
157
+ {"id": "M1_happy_free_07", "reason": "out_of_scope"}
158
+ {"id": "M1_happy_free_08", "reason": "out_of_scope"}
159
+ {"id": "M1_happy_free_09", "reason": "out_of_scope"}
160
+ {"id": "M1_happy_free_10", "reason": "out_of_scope"}
161
+ {"id": "M1_sad_free_01", "reason": "out_of_scope"}
162
+ {"id": "M1_sad_free_02", "reason": "out_of_scope"}
163
+ {"id": "M1_sad_free_03", "reason": "out_of_scope"}
164
+ {"id": "M1_sad_free_04", "reason": "out_of_scope"}
165
+ {"id": "M1_sad_free_05", "reason": "out_of_scope"}
166
+ {"id": "M1_sad_free_06", "reason": "out_of_scope"}
167
+ {"id": "M1_sad_free_07", "reason": "out_of_scope"}
168
+ {"id": "M1_sad_free_08", "reason": "out_of_scope"}
169
+ {"id": "M1_sad_free_09", "reason": "out_of_scope"}
170
+ {"id": "M1_sad_free_10", "reason": "out_of_scope"}
171
+ {"id": "M1_surprise_free_01", "reason": "out_of_scope"}
172
+ {"id": "M1_surprise_free_02", "reason": "out_of_scope"}
173
+ {"id": "M1_surprise_free_03", "reason": "out_of_scope"}
174
+ {"id": "M1_surprise_free_04", "reason": "out_of_scope"}
175
+ {"id": "M1_surprise_free_05", "reason": "out_of_scope"}
176
+ {"id": "M1_surprise_free_06", "reason": "out_of_scope"}
177
+ {"id": "M1_surprise_free_07", "reason": "out_of_scope"}
178
+ {"id": "M1_surprise_free_08", "reason": "out_of_scope"}
179
+ {"id": "M1_surprise_free_09", "reason": "out_of_scope"}
180
+ {"id": "M1_surprise_free_10", "reason": "out_of_scope"}
181
+ {"id": "M2_anger_free_01", "reason": "out_of_scope"}
182
+ {"id": "M2_anger_free_02", "reason": "out_of_scope"}
183
+ {"id": "M2_anger_free_03", "reason": "out_of_scope"}
184
+ {"id": "M2_anger_free_04", "reason": "out_of_scope"}
185
+ {"id": "M2_anger_free_05", "reason": "out_of_scope"}
186
+ {"id": "M2_anger_free_06", "reason": "out_of_scope"}
187
+ {"id": "M2_anger_free_07", "reason": "out_of_scope"}
188
+ {"id": "M2_anger_free_08", "reason": "out_of_scope"}
189
+ {"id": "M2_anger_free_09", "reason": "out_of_scope"}
190
+ {"id": "M2_anger_free_10", "reason": "out_of_scope"}
191
+ {"id": "M2_disgust_free_01", "reason": "out_of_scope"}
192
+ {"id": "M2_disgust_free_02", "reason": "out_of_scope"}
193
+ {"id": "M2_disgust_free_03", "reason": "out_of_scope"}
194
+ {"id": "M2_disgust_free_04", "reason": "out_of_scope"}
195
+ {"id": "M2_disgust_free_05", "reason": "out_of_scope"}
196
+ {"id": "M2_disgust_free_06", "reason": "out_of_scope"}
197
+ {"id": "M2_disgust_free_07", "reason": "out_of_scope"}
198
+ {"id": "M2_disgust_free_08", "reason": "out_of_scope"}
199
+ {"id": "M2_disgust_free_09", "reason": "out_of_scope"}
200
+ {"id": "M2_disgust_free_10", "reason": "out_of_scope"}
201
+ {"id": "M2_fear_free_01", "reason": "out_of_scope"}
202
+ {"id": "M2_fear_free_02", "reason": "out_of_scope"}
203
+ {"id": "M2_fear_free_03", "reason": "out_of_scope"}
204
+ {"id": "M2_fear_free_04", "reason": "out_of_scope"}
205
+ {"id": "M2_fear_free_05", "reason": "out_of_scope"}
206
+ {"id": "M2_fear_free_06", "reason": "out_of_scope"}
207
+ {"id": "M2_fear_free_07", "reason": "out_of_scope"}
208
+ {"id": "M2_fear_free_08", "reason": "out_of_scope"}
209
+ {"id": "M2_fear_free_09", "reason": "out_of_scope"}
210
+ {"id": "M2_fear_free_10", "reason": "out_of_scope"}
211
+ {"id": "M2_happy_free_01", "reason": "out_of_scope"}
212
+ {"id": "M2_happy_free_02", "reason": "out_of_scope"}
213
+ {"id": "M2_happy_free_03", "reason": "out_of_scope"}
214
+ {"id": "M2_happy_free_04", "reason": "out_of_scope"}
215
+ {"id": "M2_happy_free_05", "reason": "out_of_scope"}
216
+ {"id": "M2_happy_free_06", "reason": "out_of_scope"}
217
+ {"id": "M2_happy_free_07", "reason": "out_of_scope"}
218
+ {"id": "M2_happy_free_08", "reason": "out_of_scope"}
219
+ {"id": "M2_happy_free_09", "reason": "out_of_scope"}
220
+ {"id": "M2_happy_free_10", "reason": "out_of_scope"}
221
+ {"id": "M2_sad_free_01", "reason": "out_of_scope"}
222
+ {"id": "M2_sad_free_02", "reason": "out_of_scope"}
223
+ {"id": "M2_sad_free_03", "reason": "out_of_scope"}
224
+ {"id": "M2_sad_free_04", "reason": "out_of_scope"}
225
+ {"id": "M2_sad_free_05", "reason": "out_of_scope"}
226
+ {"id": "M2_sad_free_06", "reason": "out_of_scope"}
227
+ {"id": "M2_sad_free_07", "reason": "out_of_scope"}
228
+ {"id": "M2_sad_free_08", "reason": "out_of_scope"}
229
+ {"id": "M2_sad_free_09", "reason": "out_of_scope"}
230
+ {"id": "M2_sad_free_10", "reason": "out_of_scope"}
231
+ {"id": "M2_surprise_free_01", "reason": "out_of_scope"}
232
+ {"id": "M2_surprise_free_02", "reason": "out_of_scope"}
233
+ {"id": "M2_surprise_free_03", "reason": "out_of_scope"}
234
+ {"id": "M2_surprise_free_04", "reason": "out_of_scope"}
235
+ {"id": "M2_surprise_free_05", "reason": "out_of_scope"}
236
+ {"id": "M2_surprise_free_06", "reason": "out_of_scope"}
237
+ {"id": "M2_surprise_free_07", "reason": "out_of_scope"}
238
+ {"id": "M2_surprise_free_08", "reason": "out_of_scope"}
239
+ {"id": "M2_surprise_free_09", "reason": "out_of_scope"}
240
+ {"id": "M2_surprise_free_10", "reason": "out_of_scope"}
data/jvnv/samples.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/speech-bsd/excluded.jsonl ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"id": "190315_E004_02_spk0_no21_ja", "reason": "wrong_audio"}
2
+ {"id": "190329_E06_01_spk0_no3_ja", "reason": "label_too_long"}
3
+ {"id": "190329_E14_07_spk1_no3_ja", "reason": "no_speech"}
4
+ {"id": "190329_E14_16_spk1_no3_ja", "reason": "no_speech"}
5
+ {"id": "190329_E17_12_spk0_no18_ja", "reason": "wrong_audio"}
6
+ {"id": "190329_E17_12_spk0_no19_ja", "reason": "wrong_audio"}
7
+ {"id": "190329_J01_06_spk1_no6_ja", "reason": "no_speech"}
8
+ {"id": "190329_J14_05_spk0_no1_ja", "reason": "wrong_audio"}
9
+ {"id": "190329_J19_05_spk1_no2_ja", "reason": "wrong_audio"}
10
+ {"id": "190329_E02_03_spk0_no25_ja", "reason": "wrong_audio"}
11
+ {"id": "190329_E06_01_spk0_no27_ja", "reason": "wrong_audio"}
12
+ {"id": "190329_E06_01_spk0_no4_ja", "reason": "no_speech"}
13
+ {"id": "190329_E06_01_spk0_no6_ja", "reason": "no_speech"}
14
+ {"id": "190329_E06_01_spk1_no7_ja", "reason": "wrong_audio"}
15
+ {"id": "190329_E06_02_spk0_no10_ja", "reason": "wrong_audio"}
16
+ {"id": "190329_E14_16_spk0_no28_ja", "reason": "wrong_audio"}
17
+ {"id": "190329_E17_12_spk0_no21_ja", "reason": "wrong_audio"}
18
+ {"id": "190329_E17_12_spk0_no22_ja", "reason": "wrong_audio"}
19
+ {"id": "190329_E17_12_spk0_no23_ja", "reason": "wrong_audio"}
20
+ {"id": "190329_E17_12_spk0_no4_ja", "reason": "wrong_audio"}
21
+ {"id": "190329_J08_09_spk2_no39_ja", "reason": "wrong_audio"}
22
+ {"id": "190329_J10_16_spk1_no37_ja", "reason": "wrong_audio"}
23
+ {"id": "190329_J11_02_spk2_no10_ja", "reason": "no_speech"}
24
+ {"id": "190329_J11_02_spk2_no6_ja", "reason": "no_speech"}
25
+ {"id": "190329_J14_05_spk0_no15_ja", "reason": "wrong_audio"}
26
+ {"id": "190329_J14_05_spk0_no8_ja", "reason": "wrong_audio"}
27
+ {"id": "190329_J19_05_spk0_no30_ja", "reason": "no_speech"}
data/speech-bsd/samples.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
data/tedxjp10k/excluded.jsonl ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"id": "0KTVqevvEjo-00023495-00023640", "reason": "wrong_audio"}
2
+ {"id": "0KTVqevvEjo-00039568-00039827", "reason": "wrong_audio"}
3
+ {"id": "0KTVqevvEjo-00072424-00072677", "reason": "wrong_audio"}
4
+ {"id": "3cU5gRwbRiU-00060113-00060246", "reason": "label_too_long"}
5
+ {"id": "46PxgGJiqqA-00034876-00035014", "reason": "wrong_audio"}
6
+ {"id": "7GUhszccVEA-00096526-00096586", "reason": "label_too_long"}
7
+ {"id": "9_QS74NKTEo-00104874-00104974", "reason": "label_too_long"}
8
+ {"id": "Ab-KZT06gR0-00020962-00021235", "reason": "wrong_audio"}
9
+ {"id": "Ab-KZT06gR0-00031523-00031748", "reason": "wrong_audio"}
10
+ {"id": "IBrUxfKQdEA-00026800-00026938", "reason": "wrong_audio"}
11
+ {"id": "IcxboKkA9Xc-00034368-00034508", "reason": "label_too_long"}
12
+ {"id": "LzviN1x-300-00025162-00025548", "reason": "wrong_audio"}
13
+ {"id": "Mc044I55SCY-00004983-00005210", "reason": "wrong_audio"}
14
+ {"id": "Sz4qMGRA9gs-00049730-00049839", "reason": "wrong_audio"}
15
+ {"id": "Wqdb4uicNoc-00037781-00038068", "reason": "wrong_audio"}
16
+ {"id": "Wqdb4uicNoc-00041894-00041967", "reason": "label_too_long"}
17
+ {"id": "XL0SS8CChOQ-00014700-00014763", "reason": "label_too_long"}
18
+ {"id": "XL0SS8CChOQ-00090799-00090891", "reason": "label_too_long"}
19
+ {"id": "YGwoHfxDJi0-00044918-00045047", "reason": "wrong_audio"}
20
+ {"id": "cIsIaJnX2BM-00009426-00010453", "reason": "no_speech"}
21
+ {"id": "jgVBvO19VcE-00022060-00022209", "reason": "wrong_audio"}
22
+ {"id": "k3ZteZsbKWY-00081908-00082189", "reason": "wrong_audio"}
23
+ {"id": "k3ZteZsbKWY-00088979-00089217", "reason": "wrong_audio"}
24
+ {"id": "kU9LcoHaFLo-00065084-00065309", "reason": "wrong_audio"}
25
+ {"id": "knrMTJctBbg-00072037-00072169", "reason": "label_too_long"}
26
+ {"id": "lL8aJE9Xp3Y-00030457-00030636", "reason": "wrong_audio"}
27
+ {"id": "lqw9S4Kb5BE-00082677-00082871", "reason": "wrong_audio"}
28
+ {"id": "lqw9S4Kb5BE-00085270-00085487", "reason": "wrong_audio"}
29
+ {"id": "nXwLkxYZnew-00081693-00081850", "reason": "label_too_long"}
30
+ {"id": "p0jKC4x3kgk-00027918-00028064", "reason": "wrong_audio"}
31
+ {"id": "p0jKC4x3kgk-00034285-00034435", "reason": "wrong_audio"}
32
+ {"id": "saHZ4bN3h28-00053729-00053874", "reason": "wrong_audio"}
33
+ {"id": "t3MMsIG94cI-00059659-00059804", "reason": "label_too_long"}
data/tedxjp10k/samples.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
rebuild.py ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Rebuild asr-ja-bench from the upstream corpora.
3
+
4
+ asr-ja-bench ships no audio and no transcripts, only which upstream samples
5
+ it uses and how their transcripts were corrected. This script reads each
6
+ upstream corpus, takes the listed samples in order, applies the corrections,
7
+ checks every transcript against its published hash, and writes the benchmark:
8
+
9
+ <out>/<subset>.jsonl {"id", "audio", "text", "duration"} per sample
10
+ <out>/audio/<subset>/<id>.flac 16 kHz mono, 16-bit PCM
11
+
12
+ Inputs (see the dataset card for where to get each):
13
+
14
+ --jsut jsut_ver1.1.zip, or the directory it extracts to
15
+ --jvnv jvnv_ver1.zip, or the directory it extracts to
16
+ --tedxjp10k the TEDxJP-10K v1.1 directory written by Laboro.AI's
17
+ compose_tedxjp10k.py (text, segments, wav/)
18
+ FLEURS and SpeechBSD are read from the Hugging Face Hub at pinned revisions
19
+ (SpeechBSD is gated: accept its terms on the Hub and log in first).
20
+
21
+ python rebuild.py --jsut jsut_ver1.1.zip --jvnv jvnv_ver1.zip \\
22
+ --tedxjp10k TEDxJP-10K_v1.1 --out asr-ja-bench-v1.1
23
+ python rebuild.py ... --subset fleurs --text-only # transcripts only
24
+
25
+ Requires: numpy, soundfile, pyarrow, huggingface_hub, and the ffmpeg command
26
+ (JSUT and JVNV are 48 kHz; resampling them with ffmpeg's default resampler
27
+ reproduces the benchmark audio bit for bit, tested with ffmpeg 7.1).
28
+ Exits non-zero if any transcript fails its hash or a listed sample is missing.
29
+ """
30
+
31
+ from __future__ import annotations
32
+
33
+ import argparse
34
+ import csv
35
+ import hashlib
36
+ import io
37
+ import json
38
+ import shutil
39
+ import subprocess
40
+ import sys
41
+ import tarfile
42
+ import zipfile
43
+ from dataclasses import dataclass
44
+ from pathlib import Path
45
+ from typing import Callable, Iterator
46
+
47
+ import numpy as np
48
+ import soundfile as sf
49
+
50
+ SUBSETS = ("jsut", "jvnv", "tedxjp10k", "fleurs", "speech-bsd")
51
+ SAMPLE_RATE = 16000
52
+
53
+ FLEURS = {"repo": "google/fleurs", "revision": "70bb2e84b976b7e960aa89f1c648e09c59f894dd",
54
+ "config": "ja_jp"}
55
+ SPEECH_BSD = {"repo": "ku-nlp/speech-bsd-hf", "revision": "c925805c8607193b3a89fc705a61bd3647cd31f2"}
56
+
57
+
58
+ @dataclass
59
+ class Upstream:
60
+ """One upstream sample: its transcript and a loader for its 16 kHz mono audio."""
61
+ text: str
62
+ audio: Callable[[], np.ndarray]
63
+
64
+
65
+ # ---------------------------------------------------------------------------
66
+ # transcripts: hash and patch
67
+ # ---------------------------------------------------------------------------
68
+ def text_sha256(text: str) -> str:
69
+ return hashlib.sha256(text.encode("utf-8")).hexdigest()
70
+
71
+
72
+ def apply_patch(text: str, patch: list | None) -> str:
73
+ """Apply [[start, end, replacement], ...] (code-point offsets into the
74
+ upstream text, non-overlapping, ascending) from the right."""
75
+ for start, end, replacement in reversed(patch or []):
76
+ text = text[:start] + replacement + text[end:]
77
+ return text
78
+
79
+
80
+ def make_patch(source: str, target: str) -> list | None:
81
+ """The patch apply_patch(source, patch) == target. Carries only the
82
+ replacement characters, never the source text."""
83
+ import difflib
84
+ if source == target:
85
+ return None
86
+ ops = [[i1, i2, target[j1:j2]]
87
+ for tag, i1, i2, j1, j2 in difflib.SequenceMatcher(None, source, target, autojunk=False).get_opcodes()
88
+ if tag != "equal"]
89
+ if sum(len(r) for _, _, r in ops) > len(target) / 2:
90
+ ops = [[0, len(source), target]] # mostly rewritten: one replacement reads better
91
+ assert apply_patch(source, ops) == target
92
+ return ops
93
+
94
+
95
+ # ---------------------------------------------------------------------------
96
+ # upstream readers: {upstream_id: Upstream}
97
+ # ---------------------------------------------------------------------------
98
+ class Archive:
99
+ """A corpus zip or the directory it extracts to, read the same way."""
100
+
101
+ def __init__(self, path: Path):
102
+ self.path = path
103
+ self.zip = zipfile.ZipFile(path) if path.is_file() else None
104
+
105
+ def read(self, name: str) -> bytes:
106
+ if self.zip:
107
+ return self.zip.read(name)
108
+ return (self.path / name).read_bytes()
109
+
110
+ def names(self) -> set[str]:
111
+ if self.zip:
112
+ return set(self.zip.namelist())
113
+ return {str(p.relative_to(self.path)) for p in self.path.rglob("*")}
114
+
115
+
116
+ def _decode(data: bytes) -> np.ndarray:
117
+ """16 kHz mono float32. Other rates and multi-channel audio go through ffmpeg,
118
+ which is how the benchmark audio was made."""
119
+ info = sf.info(io.BytesIO(data))
120
+ if info.samplerate == SAMPLE_RATE and info.channels == 1:
121
+ return sf.read(io.BytesIO(data), dtype="float32")[0]
122
+ if shutil.which("ffmpeg") is None:
123
+ raise SystemExit("ffmpeg not found on PATH (needed to resample to 16 kHz)")
124
+ out = subprocess.run(["ffmpeg", "-v", "error", "-i", "-", "-ar", str(SAMPLE_RATE), "-ac", "1",
125
+ "-f", "f32le", "-"], input=data, capture_output=True, check=True).stdout
126
+ return np.frombuffer(out, dtype="float32")
127
+
128
+
129
+ def read_jsut(path: Path) -> dict[str, Upstream]:
130
+ a = Archive(path)
131
+ root = "jsut_ver1.1/" if a.zip else ""
132
+ out = {}
133
+ for line in a.read(f"{root}basic5000/transcript_utf8.txt").decode("utf-8").splitlines():
134
+ if line.strip():
135
+ uid, text = line.split(":", 1)
136
+ out[uid] = Upstream(text, lambda u=uid: _decode(a.read(f"{root}basic5000/wav/{u}.wav")))
137
+ return out
138
+
139
+
140
+ def read_jvnv(path: Path) -> dict[str, Upstream]:
141
+ # transcription.csv rows are `<emotion>_<session>_<n>|<nonverbal phrase>|<full text>`,
142
+ # shared by the four speakers; the transcript is the full text.
143
+ a = Archive(path)
144
+ root = "jvnv_v1/" if a.zip else ""
145
+ scripts = {}
146
+ for line in a.read(f"{root}transcription.csv").decode("utf-8").splitlines():
147
+ if line.strip():
148
+ key, _nonverbal, text = line.split("|")
149
+ scripts[key] = text.strip()
150
+ names = a.names()
151
+ out = {}
152
+ for spk in ("F1", "F2", "M1", "M2"):
153
+ for key, text in scripts.items():
154
+ emotion, session, _n = key.split("_")
155
+ uid = f"{spk}_{key}"
156
+ name = f"{root}{spk}/{emotion}/{session}/{uid}.wav"
157
+ if name in names: # not every speaker recorded every script line
158
+ out[uid] = Upstream(text, lambda n=name: _decode(a.read(n)))
159
+ return out
160
+
161
+
162
+ def read_tedxjp10k(path: Path) -> dict[str, Upstream]:
163
+ texts = {}
164
+ for line in (path / "text").read_text(encoding="utf-8").splitlines():
165
+ parts = line.split(maxsplit=1)
166
+ if len(parts) == 2:
167
+ texts[parts[0]] = parts[1]
168
+ cache: dict[str, np.ndarray] = {}
169
+
170
+ def cut(video: str, start: float, end: float) -> np.ndarray:
171
+ if video not in cache:
172
+ cache.clear() # one video at a time; samples come in video order
173
+ cache[video] = sf.read(path / "wav" / f"{video}.16k.wav", dtype="int16")[0]
174
+ x = cache[video]
175
+ a, b = int(start * SAMPLE_RATE), min(int(end * SAMPLE_RATE), len(x))
176
+ return x[a:b].astype("float32") / 32768
177
+
178
+ out = {}
179
+ for line in (path / "segments").read_text(encoding="utf-8").splitlines():
180
+ uid, video, start, end = line.split()
181
+ if uid in texts:
182
+ out[uid] = Upstream(texts[uid], lambda v=video, s=float(start), e=float(end): cut(v, s, e))
183
+ return out
184
+
185
+
186
+ def _hub(repo: str, filename: str, revision: str) -> str:
187
+ from huggingface_hub import hf_hub_download
188
+ return hf_hub_download(repo, filename, repo_type="dataset", revision=revision)
189
+
190
+
191
+ def read_fleurs() -> dict[str, Upstream]:
192
+ rev, cfg = FLEURS["revision"], FLEURS["config"]
193
+ texts = {}
194
+ with open(_hub(FLEURS["repo"], f"data/{cfg}/test.tsv", rev), encoding="utf-8") as f:
195
+ for row in csv.reader(f, delimiter="\t", quoting=csv.QUOTE_NONE):
196
+ texts[row[1].removesuffix(".wav")] = row[3] # file name -> transcription
197
+ audio = {}
198
+ with tarfile.open(_hub(FLEURS["repo"], f"data/{cfg}/audio/test.tar.gz", rev)) as tf:
199
+ for m in tf:
200
+ if m.isfile() and m.name.endswith(".wav"):
201
+ audio[m.name.rsplit("/", 1)[-1].removesuffix(".wav")] = tf.extractfile(m).read()
202
+ return {uid: Upstream(text, lambda d=audio[uid]: _decode(d)) for uid, text in texts.items() if uid in audio}
203
+
204
+
205
+ def read_speech_bsd() -> dict[str, Upstream]:
206
+ import pyarrow.parquet as pq
207
+ from huggingface_hub import HfApi
208
+
209
+ rev = SPEECH_BSD["revision"]
210
+ files = sorted(f for f in HfApi().list_repo_files(SPEECH_BSD["repo"], repo_type="dataset", revision=rev)
211
+ if f.startswith("data/test-"))
212
+ out = {}
213
+ for f in files:
214
+ table = pq.read_table(_hub(SPEECH_BSD["repo"], f, rev), columns=["ja_wav", "ja_sentence", "audio"])
215
+ for row in table.to_pylist():
216
+ if row["ja_wav"]:
217
+ uid = Path(row["ja_wav"]).stem
218
+ out[uid] = Upstream(row["ja_sentence"], lambda d=row["audio"]["bytes"]: _decode(d))
219
+ return out
220
+
221
+
222
+ def read_upstream(subset: str, args) -> dict[str, Upstream]:
223
+ if subset in ("jsut", "jvnv", "tedxjp10k"):
224
+ path = getattr(args, subset)
225
+ if path is None:
226
+ raise SystemExit(f"{subset}: pass --{subset} (see the dataset card for where to get it)")
227
+ return {"jsut": read_jsut, "jvnv": read_jvnv, "tedxjp10k": read_tedxjp10k}[subset](path)
228
+ return read_fleurs() if subset == "fleurs" else read_speech_bsd()
229
+
230
+
231
+ # ---------------------------------------------------------------------------
232
+ # rebuild
233
+ # ---------------------------------------------------------------------------
234
+ def rebuild_subset(subset: str, samples: list[dict], upstream: dict[str, Upstream],
235
+ out: Path | None) -> tuple[list[dict], list[str]]:
236
+ rows, problems = [], []
237
+ for s in samples:
238
+ u = upstream.get(s["id"])
239
+ if u is None:
240
+ problems.append(f"{s['id']}: not found upstream")
241
+ continue
242
+ if text_sha256(u.text) != s["upstream_sha256"]:
243
+ problems.append(f"{s['id']}: upstream transcript differs from the one this "
244
+ f"benchmark was built from")
245
+ continue
246
+ text = apply_patch(u.text, s.get("patch"))
247
+ if text_sha256(text) != s["text_sha256"]:
248
+ problems.append(f"{s['id']}: corrected transcript fails its hash")
249
+ continue
250
+ row = {"id": s["id"], "text": text, "duration": s["duration"]}
251
+ if out is not None:
252
+ x = u.audio()
253
+ rel = f"audio/{subset}/{s['id']}.flac"
254
+ sf.write(out / rel, x, SAMPLE_RATE, format="FLAC", subtype="PCM_16")
255
+ row = {"id": s["id"], "audio": rel, "text": text, "duration": round(len(x) / SAMPLE_RATE, 4)}
256
+ rows.append(row)
257
+ return rows, problems
258
+
259
+
260
+ def main(argv=None) -> int:
261
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
262
+ ap.add_argument("--data", type=Path, default=Path(__file__).resolve().parent / "data",
263
+ help="this dataset's data/ directory (default: next to this script)")
264
+ ap.add_argument("--out", type=Path, help="output directory (required unless --text-only)")
265
+ ap.add_argument("--subset", action="append", choices=SUBSETS, help="repeatable; default: all")
266
+ ap.add_argument("--text-only", action="store_true", help="check transcripts, write no audio")
267
+ ap.add_argument("--jsut", type=Path)
268
+ ap.add_argument("--jvnv", type=Path)
269
+ ap.add_argument("--tedxjp10k", type=Path)
270
+ args = ap.parse_args(argv)
271
+ if args.out is None and not args.text_only:
272
+ ap.error("--out is required unless --text-only")
273
+
274
+ failed = 0
275
+ for subset in args.subset or SUBSETS:
276
+ with open(args.data / subset / "samples.jsonl", encoding="utf-8") as f:
277
+ samples = [json.loads(line) for line in f if line.strip()]
278
+ print(f"[{subset}] reading upstream ...", flush=True)
279
+ upstream = read_upstream(subset, args)
280
+ audio_out = None if args.text_only else args.out
281
+ if audio_out is not None:
282
+ (audio_out / "audio" / subset).mkdir(parents=True, exist_ok=True)
283
+ rows, problems = rebuild_subset(subset, samples, upstream, audio_out)
284
+ if args.out is not None:
285
+ args.out.mkdir(parents=True, exist_ok=True)
286
+ with open(args.out / f"{subset}.jsonl", "w", encoding="utf-8") as f:
287
+ for r in rows:
288
+ f.write(json.dumps(r, ensure_ascii=False) + "\n")
289
+ for p in problems[:10]:
290
+ print(f"[{subset}] {p}", file=sys.stderr)
291
+ print(f"[{subset}] {len(rows)}/{len(samples)} samples rebuilt"
292
+ + (f", {len(problems)} problems" if problems else ", all transcripts verified"), flush=True)
293
+ failed += bool(problems)
294
+ return 1 if failed else 0
295
+
296
+
297
+ if __name__ == "__main__":
298
+ sys.exit(main())