OpenBible_Swahili / README.md
w11wo's picture
Fix equations for KaTeX
14c6759
---
pretty_name: OpenBible Swahili
language:
- swa
license: cc-by-sa-4.0
task_categories:
- automatic-speech-recognition
- text-to-speech
---
# Dataset Card for OpenBible Swahili
OpenBible Swahili is a verse-level segmented audio of [Swahili: Biblica® Open Kiswahili Contemporary Version (Neno)](https://open.bible/bibles/swahili-biblica-audio-bible/). This dataset/project is inspired by [masakhane-io/bibleTTS](https://github.com/masakhane-io/bibleTTS) and [coqui-ai/open-bible-scripts](https://github.com/coqui-ai/open-bible-scripts), with a twist of applying the more recent [Massively Multilingual Speech (MMS)](https://arxiv.org/abs/2305.13516) for audio alignment.
## Dataset Details
### Dataset Description
> For a more detailed description, please refer to [OpenBible-TTS](https://github.com/bookbot-hive/OpenBible-TTS/tree/main).
We followed the [CTC Forced Alignment API Tutorial](https://pytorch.org/audio/main/tutorials/ctc_forced_alignment_api_tutorial.html) graciously provided by PyTorch. We used the [Massively Multilingual Speech (MMS)](https://arxiv.org/abs/2305.13516) model to align the audio to the text.
Like the challenges explained in the MMS paper, we also faced the same noisy audio alignment issues:
- Chapter introduction narration
- Occasional verse number reading
- Digits/number handling
While [masakhane-io/bibleTTS](https://github.com/masakhane-io/bibleTTS) proposes a solution by manually (1) inserting chapter introduction transcript and (2) spells out numbers, we decided to use a mix of MMS' method by (1) inserting `*` token for additional speech (e.g. chapter introduction, verse number reading) and (2) converting digits to words using [num2words](https://github.com/rhasspy/num2words), if available.
The aligned verse text and audio are then segmented into verse-level segments for TTS model training.
As proposed in §3.1.5 of [MMS](https://arxiv.org/abs/2305.13516), we also implemented a length-normalized probability difference filtering to remove noisy alignments based on the following equation:
$$\frac{1}{T} \left[\log P\left(Y^{\text {aligned}} \mid X\right)-\log P\left(Y^{\text {greedy}} \mid X\right)\right]$$
where \\(T\\) is the length of the audio, \\(P\left(Y^{\text{aligned}} \mid X\right)\\) is the probability of the forced-alignment path, and \\(P\left(Y^{\text{greedy}} \mid X\right)\\) is the probability of the greedy sequence.
Like MMS, we select `−0.2` as the default threshold and choose samples with scores greater than this threshold. We call the resultant subsets `clean`, which you can load as shown in the [Usage section](#usage).
> ⚠️ **2 Chronicles 13-14 (`2CH_013`, `2CH_014`) have corrupt source audio. In the non-`clean` subsets, these chapters might be problematic for training!**
We recommend reading the MMS paper for better understanding.
- **Homepage:** [https://github.com/bookbot-hive/OpenBible-TTS/](https://github.com/bookbot-hive/OpenBible-TTS/)
- **Repository:** [https://github.com/bookbot-hive/OpenBible-TTS/](https://github.com/bookbot-hive/OpenBible-TTS/)
- **Point of Contact:** [Wilson Wongso](mailto:[email protected])
## Usage
```py
from datasets import load_dataset
# all 66 books
dataset = load_dataset("bookbot/OpenBible_Swahili", trust_remote_code=True)
# all 66 books, clean subset
dataset = load_dataset("bookbot/OpenBible_Swahili", "clean", trust_remote_code=True)
# only Genesis
dataset = load_dataset("bookbot/OpenBible_Swahili", "GEN", trust_remote_code=True)
# only Genesis, clean subset
dataset = load_dataset("bookbot/OpenBible_Swahili", "GEN_clean", trust_remote_code=True)
```
## Dataset Structure
### Data Instances
```python
{
"id": "GEN_001_001",
"verse_id": "GEN 1:1",
"audio": {
"path": "GEN/GEN_001/GEN_001_001.wav",
"array": array([0.0010376, 0.0007019, 0.00015259, ..., 0.00817871, 0.00482178, 0.01132202]),
"sampling_rate": 44100,
},
"verse_text": "Hapo mwanzo Mungu aliumba mbingu na dunia.",
"transcript": "hapo mwanzo mungu aliumba mbingu na dunia",
}
```
### Data Fields
- `id`: a unique identifier for the verse, formatted as `BOOK_CHAPTER_VERSE`.
- `verse_id`: the verse identifier, formatted as `BOOK CHAPTER:VERSE`.
- `audio`: a dictionary containing the path to the audio file, the decoded audio array, and the sampling rate.
- `path`: the path to the audio file.
- `array`: the decoded audio array.
- `sampling_rate`: the sampling rate of the audio.
- `verse_text`: the verse text, with proper capitalization and punctuations.
- `transcript`: the lowercased, punctuation-removed version of `verse_text`, used during forced-alignment.
### Data Splits
| USX Code | Book Name | #verses | #verses (clean) |
| :------: | --------------- | --------: | --------------: |
| GEN | Genesis | 1533 | 1498 |
| EXO | Exodus | 1213 | 1070 |
| LEV | Leviticus | 859 | 813 |
| NUM | Numbers | 1288 | 1188 |
| DEU | Deuteronomy | 959 | 940 |
| JOS | Joshua | 658 | 585 |
| JDG | Judges | 618 | 610 |
| RUT | Ruth | 85 | 83 |
| 1SA | 1 Samuel | 810 | 799 |
| 2SA | 2 Samuel | 695 | 672 |
| 1KI | 1 Kings | 816 | 773 |
| 2KI | 2 Kings | 719 | 597 |
| 1CH | 1 Chronicles | 942 | 859 |
| 2CH | 2 Chronicles | 822 | 692 |
| EZR | Ezra | 280 | 226 |
| NEH | Nehemiah | 406 | 353 |
| EST | Esther | 167 | 166 |
| JOB | Job | 1070 | 1050 |
| PSA | Psalms | 2461 | 2367 |
| PRO | Proverbs | 915 | 893 |
| ECC | Ecclesiastes | 222 | 221 |
| SNG | Song of Songs | 117 | 114 |
| ISA | Isaiah | 1292 | 1223 |
| JER | Jeremiah | 1364 | 1297 |
| LAM | Lamentations | 154 | 149 |
| EZK | Ezekiel | 1273 | 1258 |
| DAN | Daniel | 357 | 335 |
| HOS | Hosea | 197 | 194 |
| JOL | Joel | 73 | 70 |
| AMO | Amos | 146 | 144 |
| OBA | Obadiah | 21 | 20 |
| JON | Jonah | 48 | 48 |
| MIC | Micah | 105 | 103 |
| NAM | Nahum | 47 | 46 |
| HAB | Habakkuk | 56 | 55 |
| ZEP | Zephaniah | 53 | 53 |
| HAG | Haggai | 38 | 37 |
| ZEC | Zechariah | 211 | 211 |
| MAL | Malachi | 55 | 55 |
| MAT | Matthew | 1071 | 1004 |
| MRK | Mark | 678 | 557 |
| LUK | Luke | 1151 | 1027 |
| JHN | John | 879 | 856 |
| ACT | Acts | 1007 | 916 |
| ROM | Romans | 433 | 416 |
| 1CO | 1 Corinthians | 437 | 404 |
| 2CO | 2 Corinthians | 257 | 252 |
| GAL | Galatians | 149 | 145 |
| EPH | Ephesians | 155 | 152 |
| PHP | Philippians | 104 | 99 |
| COL | Colossians | 95 | 89 |
| 1TH | 1 Thessalonians | 89 | 86 |
| 2TH | 2 Thessalonians | 47 | 47 |
| 1TI | 1 Timothy | 113 | 109 |
| 2TI | 2 Timothy | 83 | 83 |
| TIT | Titus | 46 | 42 |
| PHM | Philemon | 25 | 24 |
| HEB | Hebrews | 303 | 278 |
| JAS | James | 108 | 108 |
| 1PE | 1 Peter | 105 | 91 |
| 2PE | 2 Peter | 61 | 56 |
| 1JN | 1 John | 105 | 103 |
| 2JN | 2 John | 13 | 13 |
| 3JN | 3 John | 15 | 15 |
| JUD | Jude | 25 | 24 |
| REV | Revelation | 404 | 370 |
| | **Total** | **31103** | **29233** |
## Additional Information
### Licensing Information
[CC-BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)