Everlyn commited on
Commit
4d19b31
·
verified ·
1 Parent(s): e2b7f4d

Add README.md

Browse files
Files changed (1) hide show
  1. README.md +73 -132
README.md CHANGED
@@ -16,7 +16,7 @@ tags:
16
  - speech-to-text
17
  pretty_name: KenSpeech
18
  size_categories:
19
- - 10K<n<100K
20
  ---
21
 
22
  # KenSpeech: A Swahili Speech Dataset for ASR
@@ -35,209 +35,154 @@ size_categories:
35
  | Total Speakers | 26 |
36
  | Female Speakers | 19 |
37
  | Male Speakers | 7 |
38
- | Total Transcript Files | 7,939 |
39
  | Lexicon Words | 31,728+ |
40
 
41
  ## Audio Format
42
 
43
- All audio recordings are standardized to the following format:
44
-
45
  | Property | Value |
46
  |----------|-------|
47
- | Format | WAV |
48
- | Bit Depth | 16-bit |
49
  | Sample Rate | 16 kHz |
50
  | Channels | Mono |
51
- | Byte Order | Little Endian |
52
 
53
  ---
54
 
55
- ## Dataset Components
56
-
57
- ### 1. Speech Transcripts (`stt_transcripts/`)
58
-
59
- Contains **7,939 transcript files** with corresponding audio transcriptions. Each transcript file is named to match its corresponding audio file.
60
-
61
- **Example:**
62
- - Audio: `tweet_5701.wav`
63
- - Transcript: `tweet_5701.txt`
64
-
65
- ### 2. Dictionary Dataset (`stt_dictionary/`)
66
-
67
- Contains audio recordings organized by speaker, along with corresponding transcripts, metadata, and a pronunciation lexicon.
68
 
69
- #### Structure:
70
  ```
71
- stt_dictionary/
72
- ├── metadata.csv # Main metadata file linking audio to transcripts
73
- ├── lexicon.csv # Pronunciation dictionary (31K+ words)
74
- ├── audios/
75
- ├── female/
76
- │ │ ├── speaker_1/
77
- │ │ ├── speaker_2/
78
- │ │ └── ... (11 female speakers)
79
- │ └── male/
80
- │ ├── speaker_1/
81
- │ ├── speaker_2/
82
- │ └── ... (8 male speakers)
83
- └── transcripts/
84
- └── *.txt (7,936 transcript files)
85
  ```
86
 
87
- #### Metadata Schema (`metadata.csv`)
 
 
88
 
89
  | Column | Type | Description |
90
  |--------|------|-------------|
91
- | audio_path | string | Relative path to audio file |
 
 
 
92
  | transcript | string | Transcription text |
93
- | gender | string | Speaker gender (male/female) |
94
- | speaker_id | string | Speaker identifier (speaker_1, speaker_2, etc.) |
95
- | audio_format | string | Audio format (wav, mp3, mp4, m4a) |
96
- | sample_id | string | Sample identifier |
97
-
98
- ### 3. Pronunciation Lexicon (`9sw01_swa_stt_dictionary_csv.csv`)
99
 
100
- A comprehensive **Swahili lexicon-phone dictionary** containing over **31,000 words** with their phonetic transcriptions. This lexicon uses the Swahili phoneset as defined by KenCorpus.
101
 
102
- **Format:** `word,phoneme_sequence`
103
-
104
- **Example entries:**
105
- ```
106
- wanapaswa,W AH N AH P AH S W AH
107
- wanapea,W AH N AH P EH AH
108
- wanapendwa,W AH N AH P EH ND W AH
109
- wanasema,W AH N AH S EH M AH
110
  ```
111
 
112
  ---
113
 
114
  ## Usage
115
 
116
- ### Loading with Metadata
117
 
118
  ```python
119
  import pandas as pd
120
  from datasets import Dataset, Audio
121
 
122
- # Load the metadata
123
- metadata = pd.read_csv("stt_dictionary/metadata.csv")
124
-
125
- print(f"Total samples: {len(metadata)}")
126
- print(f"\nGender distribution:")
127
- print(metadata['gender'].value_counts())
128
 
129
- print(f"\nSample record:")
130
- print(metadata.iloc[0])
131
  ```
132
 
133
- ### Loading as Hugging Face Dataset
134
 
135
  ```python
136
- from datasets import Dataset, Audio
137
- import pandas as pd
138
 
139
- # Load metadata
140
- df = pd.read_csv("stt_dictionary/metadata.csv")
141
-
142
- # Create dataset
143
- dataset = Dataset.from_pandas(df)
144
-
145
- # Cast audio column to Audio type
146
- dataset = dataset.cast_column("audio_path", Audio(sampling_rate=16000))
147
 
148
  # Access samples
149
- print(dataset[0])
150
  ```
151
 
152
- ### Filtering by Gender/Speaker
153
 
154
  ```python
155
  import pandas as pd
156
 
157
- metadata = pd.read_csv("stt_dictionary/metadata.csv")
158
 
159
- # Filter female speakers only
160
- female_samples = metadata[metadata['gender'] == 'female']
161
- print(f"Female samples: {len(female_samples)}")
162
 
163
- # Filter by specific speaker
164
- speaker_1_samples = metadata[metadata['speaker_id'] == 'speaker_1']
165
- print(f"Speaker 1 samples: {len(speaker_1_samples)}")
166
  ```
167
 
168
- ### Loading the Pronunciation Lexicon
169
 
170
  ```python
 
171
  import pandas as pd
172
 
173
- # Load the lexicon
174
- lexicon = pd.read_csv(
175
- "KenSpeech/stt_dictionary/9sw01_swa_stt_dictionary_csv.csv",
176
- header=None,
177
- names=['word', 'phonemes'],
178
- usecols=[0, 1]
179
- )
180
 
181
- print(f"Lexicon contains {len(lexicon)} words")
182
- print(lexicon.head(10))
 
 
 
 
183
  ```
184
 
185
- ### Training ASR Model (Example with Hugging Face)
186
 
187
- ```python
188
- from datasets import load_dataset, Audio
189
- from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
190
 
191
- # Load a pre-trained multilingual model
192
- model_name = "facebook/wav2vec2-large-xlsr-53"
193
- processor = Wav2Vec2Processor.from_pretrained(model_name)
194
- model = Wav2Vec2ForCTC.from_pretrained(model_name)
195
 
196
- # Process audio files for training
197
- # (Additional preprocessing code would go here)
 
 
 
198
  ```
199
 
200
  ---
201
 
202
  ## Speech Types
203
 
204
- The dataset contains two types of speech:
205
-
206
- ### Read Speech (96.4%)
207
- - Duration: 26 hours 32 minutes 37 seconds
208
- - Carefully articulated recordings from prepared texts
209
- - Higher quality and consistency
210
-
211
- ### Spontaneous Speech (3.6%)
212
- - Duration: 59 minutes 13 seconds
213
- - Natural, unscripted speech
214
- - More representative of real-world scenarios
215
 
216
  ---
217
 
218
  ## Intended Uses
219
 
220
- ### Primary Uses
221
  - Training automatic speech recognition (ASR) systems for Swahili
222
  - Evaluating speech-to-text models
223
  - Phonetic and linguistic research on Swahili
224
  - Building text-to-speech (TTS) systems
225
  - Transfer learning for other Bantu languages
226
 
227
- ### Out-of-Scope Uses
228
- - Non-speech audio processing
229
- - Languages other than Swahili
230
- - Speaker identification (speakers are anonymized)
231
-
232
- ---
233
-
234
- ## Limitations
235
-
236
- - **Regional Focus**: Recordings are from Kenyan Swahili speakers, which may not represent all Swahili dialects (e.g., Tanzanian Swahili)
237
- - **Speaker Diversity**: Limited to 26 speakers with gender imbalance (19 female, 7 male)
238
- - **Recording Conditions**: Recordings were made in controlled environments; performance may vary in noisy conditions
239
- - **Spontaneous Speech**: Limited spontaneous speech data (~4% of total)
240
-
241
  ---
242
 
243
  ## Dataset Curators
@@ -251,8 +196,6 @@ The dataset contains two types of speech:
251
 
252
  ## Citation
253
 
254
- If you use this dataset in your research, please cite:
255
-
256
  ```bibtex
257
  @article{wanjawa2022kencorpus,
258
  title={Kencorpus: A Kenyan Language Corpus of Swahili, Dholuo and Luhya for Natural Language Processing Tasks},
@@ -268,8 +211,6 @@ If you use this dataset in your research, please cite:
268
 
269
  - **Research Paper**: https://arxiv.org/abs/2208.12081
270
  - **Dataverse**: https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/KLCKL5
271
- - **ResearchGate**: https://www.researchgate.net/publication/371767223
272
- - **Semantic Scholar**: https://www.semanticscholar.org/paper/8cf70c5cd8b195ed7a399ea2cdc0b0e8f08c61ce
273
 
274
  ---
275
 
@@ -281,4 +222,4 @@ This dataset is licensed under **CC-BY-4.0**.
281
 
282
  ## Acknowledgments
283
 
284
- This dataset is part of the **Kencorpus** project, which aims to create NLP and speech resources for low-resource Kenyan languages. We thank all speakers and annotators who contributed to this dataset.
 
16
  - speech-to-text
17
  pretty_name: KenSpeech
18
  size_categories:
19
+ - 1K<n<10K
20
  ---
21
 
22
  # KenSpeech: A Swahili Speech Dataset for ASR
 
35
  | Total Speakers | 26 |
36
  | Female Speakers | 19 |
37
  | Male Speakers | 7 |
 
38
  | Lexicon Words | 31,728+ |
39
 
40
  ## Audio Format
41
 
 
 
42
  | Property | Value |
43
  |----------|-------|
44
+ | Format | WAV/MP3/MP4/M4A |
 
45
  | Sample Rate | 16 kHz |
46
  | Channels | Mono |
 
47
 
48
  ---
49
 
50
+ ## Dataset Structure
 
 
 
 
 
 
 
 
 
 
 
 
51
 
 
52
  ```
53
+ KenSpeech/
54
+ ├── README.md
55
+ ├── metadata.csv # Main dataset with audio paths and transcripts
56
+ ├── transcripts_only.csv # Additional transcripts without audio
57
+ ├── lexicon.csv # Pronunciation dictionary (31K+ words)
58
+ ── audio/ # Audio files
59
+ ── *.wav, *.mp3, *.mp4, *.m4a
 
 
 
 
 
 
 
60
  ```
61
 
62
+ ## Metadata Schema
63
+
64
+ The `metadata.csv` file contains:
65
 
66
  | Column | Type | Description |
67
  |--------|------|-------------|
68
+ | audio | string | Path to audio file (e.g., `audio/female_speaker_1_sample_261.mp4`) |
69
+ | source_folder | string | Origin folder (`stt_dictionary` or `stt_transcripts`) |
70
+ | gender | string | Speaker gender (`male` or `female`) |
71
+ | speaker | string | Speaker identifier (`speaker_1`, `speaker_2`, etc.) |
72
  | transcript | string | Transcription text |
 
 
 
 
 
 
73
 
74
+ ### Example Record
75
 
76
+ ```python
77
+ {
78
+ 'audio': 'audio/female_speaker_1_sample_261.mp4',
79
+ 'source_folder': 'stt_dictionary',
80
+ 'gender': 'female',
81
+ 'speaker': 'speaker_1',
82
+ 'transcript': 'masaa mawili kabla basi kuwasili...'
83
+ }
84
  ```
85
 
86
  ---
87
 
88
  ## Usage
89
 
90
+ ### Loading the Dataset
91
 
92
  ```python
93
  import pandas as pd
94
  from datasets import Dataset, Audio
95
 
96
+ # Load metadata
97
+ df = pd.read_csv("hf://datasets/Kencorpus/KenSpeech/metadata.csv")
 
 
 
 
98
 
99
+ print(f"Total samples: {len(df)}")
100
+ print(df.head())
101
  ```
102
 
103
+ ### Loading with Hugging Face Datasets
104
 
105
  ```python
106
+ from datasets import load_dataset
 
107
 
108
+ # Load the dataset
109
+ dataset = load_dataset("Kencorpus/KenSpeech")
 
 
 
 
 
 
110
 
111
  # Access samples
112
+ print(dataset['train'][0])
113
  ```
114
 
115
+ ### Filtering by Gender
116
 
117
  ```python
118
  import pandas as pd
119
 
120
+ df = pd.read_csv("metadata.csv")
121
 
122
+ # Get female speakers only
123
+ female_df = df[df['gender'] == 'female']
124
+ print(f"Female samples: {len(female_df)}")
125
 
126
+ # Get male speakers only
127
+ male_df = df[df['gender'] == 'male']
128
+ print(f"Male samples: {len(male_df)}")
129
  ```
130
 
131
+ ### Loading Audio with Transcripts
132
 
133
  ```python
134
+ from datasets import Dataset, Audio
135
  import pandas as pd
136
 
137
+ # Load and create dataset
138
+ df = pd.read_csv("metadata.csv")
139
+ dataset = Dataset.from_pandas(df)
140
+
141
+ # Cast audio column
142
+ dataset = dataset.cast_column("audio", Audio(sampling_rate=16000))
 
143
 
144
+ # Iterate through samples
145
+ for sample in dataset:
146
+ audio = sample['audio']
147
+ transcript = sample['transcript']
148
+ gender = sample['gender']
149
+ print(f"[{gender}] {transcript[:50]}...")
150
  ```
151
 
152
+ ---
153
 
154
+ ## Pronunciation Lexicon
155
+
156
+ The `lexicon.csv` file contains over 31,000 Swahili words with their phonetic transcriptions.
157
 
158
+ **Format:** `word,phoneme_sequence`
 
 
 
159
 
160
+ **Example entries:**
161
+ ```
162
+ wanapaswa,W AH N AH P AH S W AH
163
+ wanasema,W AH N AH S EH M AH
164
+ wanataka,W AH N AH T AH K AH
165
  ```
166
 
167
  ---
168
 
169
  ## Speech Types
170
 
171
+ | Type | Duration | Percentage |
172
+ |------|----------|------------|
173
+ | Read Speech | 26h 32m 37s | 96.4% |
174
+ | Spontaneous Speech | 59m 13s | 3.6% |
 
 
 
 
 
 
 
175
 
176
  ---
177
 
178
  ## Intended Uses
179
 
 
180
  - Training automatic speech recognition (ASR) systems for Swahili
181
  - Evaluating speech-to-text models
182
  - Phonetic and linguistic research on Swahili
183
  - Building text-to-speech (TTS) systems
184
  - Transfer learning for other Bantu languages
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  ---
187
 
188
  ## Dataset Curators
 
196
 
197
  ## Citation
198
 
 
 
199
  ```bibtex
200
  @article{wanjawa2022kencorpus,
201
  title={Kencorpus: A Kenyan Language Corpus of Swahili, Dholuo and Luhya for Natural Language Processing Tasks},
 
211
 
212
  - **Research Paper**: https://arxiv.org/abs/2208.12081
213
  - **Dataverse**: https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/KLCKL5
 
 
214
 
215
  ---
216
 
 
222
 
223
  ## Acknowledgments
224
 
225
+ This dataset is part of the **Kencorpus** project, which aims to create NLP and speech resources for low-resource Kenyan languages.