Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -41,31 +41,24 @@ size_categories:
|
|
| 41 |
|
| 42 |
| Property | Value |
|
| 43 |
|----------|-------|
|
| 44 |
-
|
|
| 45 |
-
| Sample Rate | 16 kHz |
|
| 46 |
| Channels | Mono |
|
| 47 |
|
| 48 |
---
|
| 49 |
|
| 50 |
-
## Dataset
|
| 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 |
-
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
|
| 65 |
|
| 66 |
| Column | Type | Description |
|
| 67 |
|--------|------|-------------|
|
| 68 |
-
|
|
| 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.) |
|
|
@@ -75,7 +68,7 @@ The `metadata.csv` file contains:
|
|
| 75 |
|
| 76 |
```python
|
| 77 |
{
|
| 78 |
-
'
|
| 79 |
'source_folder': 'stt_dictionary',
|
| 80 |
'gender': 'female',
|
| 81 |
'speaker': 'speaker_1',
|
|
@@ -92,18 +85,16 @@ The `metadata.csv` file contains:
|
|
| 92 |
```python
|
| 93 |
from datasets import load_dataset
|
| 94 |
|
| 95 |
-
# Load the dataset
|
| 96 |
dataset = load_dataset("Kencorpus/KenSpeech")
|
| 97 |
|
| 98 |
-
# Access
|
| 99 |
sample = dataset['train'][0]
|
| 100 |
-
print(sample)
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
# 'speaker': 'speaker_1',
|
| 106 |
-
# 'transcript': 'masaa mawili kabla basi kuwasili...'}
|
| 107 |
```
|
| 108 |
|
| 109 |
### Filtering by Gender
|
|
@@ -122,36 +113,45 @@ male_data = dataset['train'].filter(lambda x: x['gender'] == 'male')
|
|
| 122 |
print(f"Male samples: {len(male_data)}")
|
| 123 |
```
|
| 124 |
|
| 125 |
-
###
|
| 126 |
|
| 127 |
```python
|
| 128 |
from datasets import load_dataset
|
|
|
|
| 129 |
|
|
|
|
| 130 |
dataset = load_dataset("Kencorpus/KenSpeech")
|
| 131 |
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
|
|
|
|
|
|
| 138 |
```
|
| 139 |
|
| 140 |
---
|
| 141 |
|
| 142 |
-
##
|
| 143 |
|
| 144 |
-
|
|
|
|
|
|
|
| 145 |
|
| 146 |
**Format:** `word,phoneme_sequence`
|
| 147 |
|
| 148 |
-
**Example entries:**
|
| 149 |
```
|
| 150 |
wanapaswa,W AH N AH P AH S W AH
|
| 151 |
wanasema,W AH N AH S EH M AH
|
| 152 |
wanataka,W AH N AH T AH K AH
|
| 153 |
```
|
| 154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
---
|
| 156 |
|
| 157 |
## Speech Types
|
|
|
|
| 41 |
|
| 42 |
| Property | Value |
|
| 43 |
|----------|-------|
|
| 44 |
+
| Sampling Rate | 16 kHz |
|
|
|
|
| 45 |
| Channels | Mono |
|
| 46 |
|
| 47 |
---
|
| 48 |
|
| 49 |
+
## Dataset Format
|
| 50 |
|
| 51 |
+
The dataset is distributed as **Parquet files** with embedded audio for optimal compatibility:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
- **Format**: Apache Parquet (with embedded audio bytes)
|
| 54 |
+
- **Encoding**: UTF-8 for text fields
|
| 55 |
+
- **Compatibility**: Works with `datasets` 4.0.0+ without custom loading scripts
|
| 56 |
|
| 57 |
+
## Data Fields
|
| 58 |
|
| 59 |
| Column | Type | Description |
|
| 60 |
|--------|------|-------------|
|
| 61 |
+
| audio | Audio | Audio waveform (decoded array + sampling_rate) |
|
| 62 |
| source_folder | string | Origin folder (`stt_dictionary` or `stt_transcripts`) |
|
| 63 |
| gender | string | Speaker gender (`male` or `female`) |
|
| 64 |
| speaker | string | Speaker identifier (`speaker_1`, `speaker_2`, etc.) |
|
|
|
|
| 68 |
|
| 69 |
```python
|
| 70 |
{
|
| 71 |
+
'audio': {'path': '...', 'array': array([0.001, -0.003, ...]), 'sampling_rate': 16000},
|
| 72 |
'source_folder': 'stt_dictionary',
|
| 73 |
'gender': 'female',
|
| 74 |
'speaker': 'speaker_1',
|
|
|
|
| 85 |
```python
|
| 86 |
from datasets import load_dataset
|
| 87 |
|
| 88 |
+
# Load the dataset
|
| 89 |
dataset = load_dataset("Kencorpus/KenSpeech")
|
| 90 |
|
| 91 |
+
# Access a sample
|
| 92 |
sample = dataset['train'][0]
|
| 93 |
+
print(sample['transcript'])
|
| 94 |
+
print(sample['gender'])
|
| 95 |
+
print(sample['speaker'])
|
| 96 |
+
print(sample['audio']['sampling_rate']) # 16000
|
| 97 |
+
print(sample['audio']['array'].shape) # audio waveform
|
|
|
|
|
|
|
| 98 |
```
|
| 99 |
|
| 100 |
### Filtering by Gender
|
|
|
|
| 113 |
print(f"Male samples: {len(male_data)}")
|
| 114 |
```
|
| 115 |
|
| 116 |
+
### Training an ASR Model
|
| 117 |
|
| 118 |
```python
|
| 119 |
from datasets import load_dataset
|
| 120 |
+
from transformers import Wav2Vec2Processor, Wav2Vec2ForCTC
|
| 121 |
|
| 122 |
+
# Load dataset
|
| 123 |
dataset = load_dataset("Kencorpus/KenSpeech")
|
| 124 |
|
| 125 |
+
# Load a multilingual model
|
| 126 |
+
model_name = "facebook/wav2vec2-large-xlsr-53"
|
| 127 |
+
processor = Wav2Vec2Processor.from_pretrained(model_name)
|
| 128 |
+
model = Wav2Vec2ForCTC.from_pretrained(model_name)
|
| 129 |
+
|
| 130 |
+
# Process a sample
|
| 131 |
+
sample = dataset['train'][0]
|
| 132 |
+
inputs = processor(sample['audio']['array'], sampling_rate=16000, return_tensors="pt")
|
| 133 |
```
|
| 134 |
|
| 135 |
---
|
| 136 |
|
| 137 |
+
## Additional Resources
|
| 138 |
|
| 139 |
+
### Pronunciation Lexicon (`lexicon.csv`)
|
| 140 |
+
|
| 141 |
+
A Swahili lexicon-phone dictionary with over 31,000 words and their phonetic transcriptions.
|
| 142 |
|
| 143 |
**Format:** `word,phoneme_sequence`
|
| 144 |
|
|
|
|
| 145 |
```
|
| 146 |
wanapaswa,W AH N AH P AH S W AH
|
| 147 |
wanasema,W AH N AH S EH M AH
|
| 148 |
wanataka,W AH N AH T AH K AH
|
| 149 |
```
|
| 150 |
|
| 151 |
+
### Transcript-only Data (`transcripts_only.csv`)
|
| 152 |
+
|
| 153 |
+
Additional transcripts from the stt_transcripts collection without corresponding audio.
|
| 154 |
+
|
| 155 |
---
|
| 156 |
|
| 157 |
## Speech Types
|