laubonghaudoi commited on
Commit
6ac531f
·
1 Parent(s): a3791ff

更新代碼

Browse files
Files changed (3) hide show
  1. README.md +47 -40
  2. cut.py +6 -3
  3. stats.py +6 -5
README.md CHANGED
@@ -1,53 +1,53 @@
1
  ---
2
  language:
3
- - yue
4
  license: cc0-1.0
5
  size_categories:
6
- - 10K<n<100K
7
  task_categories:
8
- - automatic-speech-recognition
9
- - text-to-speech
10
- - text-generation
11
- - feature-extraction
12
- - audio-to-audio
13
- - audio-classification
14
- - text-to-audio
15
  pretty_name: c
16
  configs:
17
- - config_name: default
18
- data_files:
19
- - split: saamgwokjinji
20
- path: data/saamgwokjinji-*
21
- - split: seoiwuzyun
22
- path: data/seoiwuzyun-*
23
- - split: mouzaakdung
24
- path: data/mouzaakdung-*
25
  tags:
26
- - cantonese
27
- - audio
28
- - art
29
  dataset_info:
30
  features:
31
- - name: audio
32
- dtype: audio
33
- - name: id
34
- dtype: string
35
- - name: episode_id
36
- dtype: int64
37
- - name: audio_duration
38
- dtype: float64
39
- - name: transcription
40
- dtype: string
41
  splits:
42
- - name: saamgwokjinji
43
- num_bytes: 2398591354.589
44
- num_examples: 39173
45
- - name: seoiwuzyun
46
- num_bytes: 1629539808.0
47
- num_examples: 24744
48
- - name: mouzaakdung
49
- num_bytes: 89173361.615
50
- num_examples: 1645
51
  download_size: 4136850525
52
  dataset_size: 4117304524.204
53
  ---
@@ -60,7 +60,12 @@ dataset_info:
60
 
61
  - **Homepage:** [張悦楷講古語音數據集 The Zoeng Jyut Gaai Story-telling Speech Dataset](https://canclid.github.io/zoengjyutgaai/)
62
  - **License:** [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/)
63
- - **Total Duration:** 104 hours
 
 
 
 
 
64
 
65
  呢個係張悦楷講《三國演義》同《水滸傳》語音數據集。[張悦楷](https://zh.wikipedia.org/wiki/%E5%BC%A0%E6%82%A6%E6%A5%B7)係廣州最出名嘅講古佬 / 粵語説書藝人。佢從上世紀七十年代開始就喺廣東各個收音電台度講古,佢把聲係好多廣州人嘅共同回憶。本數據集《三國演義》係佢最知名嘅作品一。
66
 
@@ -136,9 +141,11 @@ from huggingface_hub import login
136
 
137
  sg = load_dataset('audiofolder', data_dir='./opus/saamgwokjinji')
138
  sw = load_dataset('audiofolder', data_dir='./opus/seoiwuzyun')
 
139
  dataset = DatasetDict({
140
  "saamgwokjinji": sg["train"],
141
  "seoiwuzyun": sw["train"],
 
142
  })
143
 
144
  # 檢查下讀入嘅數據有冇問題
 
1
  ---
2
  language:
3
+ - yue
4
  license: cc0-1.0
5
  size_categories:
6
+ - 10K<n<100K
7
  task_categories:
8
+ - automatic-speech-recognition
9
+ - text-to-speech
10
+ - text-generation
11
+ - feature-extraction
12
+ - audio-to-audio
13
+ - audio-classification
14
+ - text-to-audio
15
  pretty_name: c
16
  configs:
17
+ - config_name: default
18
+ data_files:
19
+ - split: saamgwokjinji
20
+ path: data/saamgwokjinji-*
21
+ - split: seoiwuzyun
22
+ path: data/seoiwuzyun-*
23
+ - split: mouzaakdung
24
+ path: data/mouzaakdung-*
25
  tags:
26
+ - cantonese
27
+ - audio
28
+ - art
29
  dataset_info:
30
  features:
31
+ - name: audio
32
+ dtype: audio
33
+ - name: id
34
+ dtype: string
35
+ - name: episode_id
36
+ dtype: int64
37
+ - name: audio_duration
38
+ dtype: float64
39
+ - name: transcription
40
+ dtype: string
41
  splits:
42
+ - name: saamgwokjinji
43
+ num_bytes: 2398591354.589
44
+ num_examples: 39173
45
+ - name: seoiwuzyun
46
+ num_bytes: 1629539808.0
47
+ num_examples: 24744
48
+ - name: mouzaakdung
49
+ num_bytes: 89173361.615
50
+ num_examples: 1645
51
  download_size: 4136850525
52
  dataset_size: 4117304524.204
53
  ---
 
60
 
61
  - **Homepage:** [張悦楷講古語音數據集 The Zoeng Jyut Gaai Story-telling Speech Dataset](https://canclid.github.io/zoengjyutgaai/)
62
  - **License:** [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/)
63
+ - **Total Duration:** 107.37 hours
64
+ - **Average Clip Duration**: 5.896 seconds
65
+ - **Median Clip Duration**: 5.438 seconds
66
+ - **Total number of characters**: 1603472
67
+ - **Language:** Cantonese (`yue`)
68
+ - **Voice Actor:** [張悦楷](https://zh.wikipedia.org/wiki/%E5%BC%A0%E6%82%A6%E6%A5%B7)
69
 
70
  呢個係張悦楷講《三國演義》同《水滸傳》語音數據集。[張悦楷](https://zh.wikipedia.org/wiki/%E5%BC%A0%E6%82%A6%E6%A5%B7)係廣州最出名嘅講古佬 / 粵語説書藝人。佢從上世紀七十年代開始就喺廣東各個收音電台度講古,佢把聲係好多廣州人嘅共同回憶。本數據集《三國演義》係佢最知名嘅作品一。
71
 
 
141
 
142
  sg = load_dataset('audiofolder', data_dir='./opus/saamgwokjinji')
143
  sw = load_dataset('audiofolder', data_dir='./opus/seoiwuzyun')
144
+ mzd = load_dataset('audiofolder', data_dir='./opus/mouzaakdung')
145
  dataset = DatasetDict({
146
  "saamgwokjinji": sg["train"],
147
  "seoiwuzyun": sw["train"],
148
+ "mouzaakdung": mzd["train"],
149
  })
150
 
151
  # 檢查下讀入嘅數據有冇問題
cut.py CHANGED
@@ -6,7 +6,7 @@ import pysrt
6
  from pydub import AudioSegment
7
 
8
 
9
- def srt_to_segments_with_metadata(srt_file, episode, audio_file, output_dir, metadata_file, subset: Literal["saamgwokjinji", "seoiwuzyun"]):
10
  # Load the SRT file
11
  subs = pysrt.open(srt_file)
12
 
@@ -33,6 +33,8 @@ def srt_to_segments_with_metadata(srt_file, episode, audio_file, output_dir, met
33
  prefix = "sg"
34
  elif subset == "seoiwuzyun":
35
  prefix = "sw"
 
 
36
 
37
  for index, sub in enumerate(subs):
38
  # Get start and end times in milliseconds
@@ -68,13 +70,14 @@ def srt_to_segments_with_metadata(srt_file, episode, audio_file, output_dir, met
68
 
69
  if __name__ == "__main__":
70
  # subset = "saamgwokjinji"
71
- subset = "seoiwuzyun"
 
72
 
73
  print(f"Processing subset: {subset}")
74
  # If append to existing metadata file
75
  metadata_file = os.path.join("opus", subset, "metadata.csv") # Define metadata file path here
76
 
77
- for episode in range(81, 93):
78
  # If creating new csv
79
  # metadata_file = f"{episode}.csv"
80
  episode_str = f'{episode:03d}' # Format episode as 3-digit string
 
6
  from pydub import AudioSegment
7
 
8
 
9
+ def srt_to_segments_with_metadata(srt_file, episode, audio_file, output_dir, metadata_file, subset: Literal["saamgwokjinji", "seoiwuzyun", "mouzaakdung"]):
10
  # Load the SRT file
11
  subs = pysrt.open(srt_file)
12
 
 
33
  prefix = "sg"
34
  elif subset == "seoiwuzyun":
35
  prefix = "sw"
36
+ elif subset == "mouzaakdung":
37
+ prefix = "mzd"
38
 
39
  for index, sub in enumerate(subs):
40
  # Get start and end times in milliseconds
 
70
 
71
  if __name__ == "__main__":
72
  # subset = "saamgwokjinji"
73
+ # subset = "seoiwuzyun"
74
+ subset = "mouzaakdung"
75
 
76
  print(f"Processing subset: {subset}")
77
  # If append to existing metadata file
78
  metadata_file = os.path.join("opus", subset, "metadata.csv") # Define metadata file path here
79
 
80
+ for episode in range(1, 11):
81
  # If creating new csv
82
  # metadata_file = f"{episode}.csv"
83
  episode_str = f'{episode:03d}' # Format episode as 3-digit string
stats.py CHANGED
@@ -72,7 +72,7 @@ def get_info(subsets: List[str] | Literal["saamgwokjinji", "seoiwuzyun"]) -> Non
72
  total_characters = metadata['transcription'].str.len().sum()
73
 
74
  # Calculate mean number of characters
75
- mean_characters = metadata['transcription'].str.len().mean()
76
 
77
  # Calculate median number of characters
78
  median_characters = metadata['transcription'].str.len().median()
@@ -82,7 +82,7 @@ def get_info(subsets: List[str] | Literal["saamgwokjinji", "seoiwuzyun"]) -> Non
82
 
83
  # Print results
84
  print(f"Total characters: {total_characters}")
85
- print(f"Mean characters per transcription: {mean_characters:.2f}")
86
  print(f"Median characters per transcription: {median_characters}")
87
  print(f"Number of unique characters: {len(unique_characters)}")
88
  print(f"Unique characters: {''.join(sorted(unique_characters))}")
@@ -91,6 +91,7 @@ def get_info(subsets: List[str] | Literal["saamgwokjinji", "seoiwuzyun"]) -> Non
91
 
92
 
93
  if __name__ == '__main__':
94
- get_info('saamgwokjinji')
95
- get_info('seoiwuzyun')
96
- get_info(['saamgwokjinji', 'seoiwuzyun'])
 
 
72
  total_characters = metadata['transcription'].str.len().sum()
73
 
74
  # Calculate mean number of characters
75
+ average_characters = metadata['transcription'].str.len().mean()
76
 
77
  # Calculate median number of characters
78
  median_characters = metadata['transcription'].str.len().median()
 
82
 
83
  # Print results
84
  print(f"Total characters: {total_characters}")
85
+ print(f"Average characters per clip: {average_characters:.2f}")
86
  print(f"Median characters per transcription: {median_characters}")
87
  print(f"Number of unique characters: {len(unique_characters)}")
88
  print(f"Unique characters: {''.join(sorted(unique_characters))}")
 
91
 
92
 
93
  if __name__ == '__main__':
94
+ # get_info('saamgwokjinji')
95
+ # get_info('seoiwuzyun')
96
+ # get_info('mouzaakdung')
97
+ get_info(['saamgwokjinji', 'seoiwuzyun', 'mouzaakdung'])