File size: 9,281 Bytes
5b73ede
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
---
language:
  - yue
license: cc0-1.0
size_categories:
  - 10K<n<100K
task_categories:
  - automatic-speech-recognition
  - text-to-speech
  - text-generation
  - feature-extraction
  - audio-to-audio
  - audio-classification
  - text-to-audio
pretty_name: c
configs:
  - config_name: default
    data_files:
      - split: saamgwokjinji
        path: data/saamgwokjinji-*
      - split: seoiwuzyun
        path: data/seoiwuzyun-*
tags:
  - cantonese
  - audio
  - art
dataset_info:
  features:
    - name: audio
      dtype: audio
    - name: id
      dtype: string
    - name: episode_id
      dtype: int64
    - name: audio_duration
      dtype: float64
    - name: transcription
      dtype: string
  splits:
    - name: saamgwokjinji
      num_bytes: 2398591354.589
      num_examples: 39173
    - name: seoiwuzyun
      num_bytes: 1629539808.0
      num_examples: 24744
  download_size: 4046904982
  dataset_size: 4028131162.589
---

# 張悦楷講《三國演義》《水滸傳》語音數據集

[English](#the-zoeng-jyut-gaai-story-telling-speech-dataset)

## Dataset Description

- **Homepage:** [張悦楷講古語音數據集 The Zoeng Jyut Gaai Story-telling Speech Dataset](https://canclid.github.io/zoengjyutgaai/)
- **License:** [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/)

呢個係張悦楷講《三國演義》同《水滸傳》語音數據集。[張悦楷](https://zh.wikipedia.org/wiki/%E5%BC%A0%E6%82%A6%E6%A5%B7)係廣州最出名嘅講古佬 / 粵語説書藝人。佢從上世紀七十年代開始就喺廣東各個收音電台度講古,佢把聲係好多廣州人嘅共同回憶。本數據集《三國演義》係佢最知名嘅作品一。

數據集用途:

- TTS(語音合成)訓練集
- ASR(語音識別)訓練集或測試集
- 各種語言學、文學研究
- 直接聽嚟欣賞藝術!

TTS 效果演示:https://huggingface.co/spaces/laubonghaudoi/zoengjyutgaai_tts

## 説明

- 所有文本都根據 https://jyutping.org/blog/typo/ 同 https://jyutping.org/blog/particles/ 規範用字。
- 所有文本都使用全角標點,冇半角標點。
- 所有文本都用漢字轉寫,無阿拉伯數字無英文字母
- 所有音頻源都存放喺`/source`,為方便直接用作訓練數據,切分後嘅音頻都放喺 `opus/`
- 所有 opus 音頻皆為 48000 Hz 採樣率。
- 所有源字幕 SRT 文件都存放喺 `srt/` 路經下,搭配 `source/` 下嘅音源可以直接作為帶字幕嘅錄音直接欣賞。
- `cut.py` 係切分腳本,將對應嘅音源根據 srt 切分成短句並生成一個文本轉寫 csv。
- `stats.py` 係統計腳本,運行佢就會顯示成個數據集嘅各項統計數據。

## 下載使用

要下載使用呢個數據集,可以喺 Python 入面直接跑:

```python
from datasets import load_dataset

ds = load_dataset("CanCLID/zoengjyutgaai")
```

如果想單純將 `opus/` 入面所有嘢下載落嚟,可以跑下面嘅 Python 代碼,注意要安裝 `pip install --upgrade huggingface_hub` 先:

```python
from huggingface_hub import snapshot_download

# 如果你淨係想下載啲字幕或者源音頻,噉就將下面嘅 `wav/*` 改成 `srt/*` 或者 `webm/*`
snapshot_download(repo_id="CanCLID/zoengjyutgaai",allow_patterns="opus/*",local_dir="./",repo_type="dataset")
```

如果唔想用 python,你亦都可以用命令行叫 git 針對克隆個`opus/`或者其他路經,避免將成個 repo 都克隆落嚟浪費空間同下載時間:

```bash
mkdir zoengjyutgaai
cd zoengjyutgaai
git init

git remote add origin https://huggingface.co/datasets/CanCLID/zoengjyutgaai
git sparse-checkout init --cone

# 指定凈係下載個別路徑
git sparse-checkout set opus

# 開始下載
git pull origin main
```

### 數據集構建流程

本數據集嘅收集、構建過程係:

1. 從 YouTube 或者國內評書網站度下載錄音源文件,一般都係每集半個鐘長嘅 `.webm` 或者 `.mp3`1. 用加字幕工具幫呢啲錄音加字幕,得到對應嘅 `.srt` 文件。
1. 將啲源錄音用下面嘅命令儘可能無壓縮噉轉換成 `.opus` 格式。
1. 運行`cut.py`,將每一集 `.opus` 按照 `.srt` 入面嘅時間點切分成一句一個 `.opus`,然後對應嘅文本寫入本數據集嘅 `xxx.csv`1. 然後打開一個 IPython,逐句跑下面嘅命令,將啲數據推上 HuggingFace。

```python
from datasets import load_dataset, DatasetDict
from huggingface_hub import login

sg = load_dataset('audiofolder', data_dir='./opus/saamgwokjinji')
sw = load_dataset('audiofolder', data_dir='./opus/seoiwuzyun')
dataset = DatasetDict({
    "saamgwokjinji": sg["train"],
    "seoiwuzyun": sw["train"],
})

# 檢查下讀入嘅數據有冇問題
dataset['train'][0]
# 準備好個 token 嚟登入
login()
# 推上 HuggingFace datasets
dataset.push_to_hub("CanCLID/zoengjyutgaai")
```

### 音頻格式轉換

首先要安裝 [ffmpeg](https://www.ffmpeg.org/download.html),然後運行:

```bash
# 將下載嘅音源由 webm 轉成 opus
ffmpeg -i webm/saamgwokjinji/001.webm -c:a copy source/saamgwokjinji/001.opus
# 或者轉 mp3
ffmpeg -i mp3/mouzaakdung/001.mp3 -c:a libopus -map_metadata -1 -b:a 48k -vbr on source/mouzaakdung/001.opus
# 將 opus 轉成無損 wav
ffmpeg -i source/saamgwokjinji/001.opus wav/saamgwokjinji/001.wav
```

如果想將所有 opus 文件全部轉換成 wav,可以直接運行`to_wav.sh`:

```
chmod +x to_wav.sh
./to_wav.sh
```

跟住就會生成一個 `wav/` 路經,入面都係 `opus/` 對應嘅音頻。注意 wav 格式非常掗埞,成個 `opus/` 轉晒後會佔用至少 500GB 儲存空間,所以轉換之前記得確保有足夠空間。如果你想對音頻重採樣,亦都可以修改 `to_wav.sh` 入面嘅命令順便做重採樣。

# The Zoeng Jyut Gaai Story-telling Speech Dataset

This is a speech dataset of Zoeng Jyut Gaai story-telling _Romance of the Three Kingdoms_ and _Water Margin_. [Zoeng Jyut Gaai](https://zh.wikipedia.org/wiki/%E5%BC%A0%E6%82%A6%E6%A5%B7) is a famous actor, stand-up commedian and story-teller (講古佬) in 20th centry Canton. His voice remains in the memories of thousands of Cantonese people. This dataset is built from one of his most well-known story-telling piece: _Romance of the Three Kingdoms_.

Use case of this dataset:

- TTS (Text-To-Speech) training set
- ASR (Automatic Speech Recognition) training or eval set
- Various linguistics / art analysis
- Just listen and enjoy the art piece!

TTS demo: https://huggingface.co/spaces/laubonghaudoi/zoengjyutgaai_tts

## Introduction

- All transcriptions follow the prescribed orthography detailed in https://jyutping.org/blog/typo/ and https://jyutping.org/blog/particles/
- All transcriptions use full-width punctuations, no half-width punctuations is used.
- All transcriptions are in Chinese characters, no Arabic numbers or Latin letters.
- All source audio are stored in `source/`. For the convenice of training, segmented audios are stored in `opus/`.
- All opus audio are in 48000 Hz sampling rate.
- All source subtitle SRT files are stored in `srt/`. Use them with the webm files to enjoy subtitled storytelling pieces.
- `cut.py` is the script for cutting opus audios into senteneces based on the srt, and generates a csv file for transcriptions.
- `stats.py` is the script for getting stats of this dataset.

## Usage

To use this dataset, simply run in Python:

```python
from datasets import load_dataset

ds = load_dataset("CanCLID/zoengjyutgaai")
```

If you only want to download a certain directory to save time and space from cloning the entire repo, run the Python codes below. Make sure you have `pip install --upgrade huggingface_hub` first:

```python
from huggingface_hub import snapshot_download

# If you only want to download the source audio or the subtitles, change the `wav/*` below into `srt/*` or `webm/*`
snapshot_download(repo_id="CanCLID/zoengjyutgaai",allow_patterns="opus/*",local_dir="./",repo_type="dataset")
```

If you don't want to run python codes and want to do this via command lines, you can selectively clone only a directory of the repo:

```bash
mkdir zoengjyutgaai
cd zoengjyutgaai
git init

git remote add origin https://huggingface.co/datasets/CanCLID/zoengjyutgaai
git sparse-checkout init --cone

# Tell git which directory you want
git sparse-checkout set opus

# Pull the content
git pull origin main
```

### Audio format conversion

Install [ffmpeg](https://www.ffmpeg.org/download.html) first, then run:

```bash
# convert all webm into opus
ffmpeg -i webm/saamgwokjinji/001.webm -c:a copy source/saamgwokjinji/001.opus
# or into mp3
ffmpeg -i mp3/mouzaakdung/001.mp3 -c:a libopus -map_metadata -1 -b:a 48k -vbr on source/mouzaakdung/001.opus
# convert all opus into loseless wav
ffmpeg -i source/saamgwokjinji/001.opus wav/saamgwokjinji/001.wav
```

If you want to convert all opus to wav, run `to_wav.sh`:

```
chmod +x to_wav.sh
./to_wav.sh
```

It will generate a `wav/` path which contains all audios converted from `opus/`. Be aware the wav format is very space-consuming. A full conversion will take up at least 500GB space so make sure you have enough storage. If you want to resample the audio, modify the line within `to_wav.sh` to resample the audio while doing the conversion.