arrandi's picture
Upload README.md with huggingface_hub
263f7b8 verified
|
Raw
History Blame Contribute Delete
5.7 kB
---
language:
- eu
license: cc-by-sa-4.0
task_categories:
- text-to-speech
tags:
- basque
- phonemization
- IPA
- wikipedia
pretty_name: Basque Wikipedia Phonemized Corpus (Text + IPA phonemes)
size_categories:
- 1M<n<10M
---
# Basque Wikipedia Phonemized Corpus (Text + IPA phonemes)
## Dataset Description
A large-scale paired corpus derived from the Basque Wikipedia dump. Each row contains both the **original plain text** and its **IPA phoneme transcription**, at paragraph level. Stressed vowels use the apostrophe convention (e.g. `'a`, `'e`, `'i`, `'o`, `'u`) and affricates are kept as multicharacter sequences (e.g. `tʃ`, `tʂ`, `ts`).
This dataset is intended for training text-to-speech (TTS) and grapheme-to-phoneme (G2P) models for Basque.
---
## Dataset Statistics
| Split | Rows |
|-------|------|
| samples | 1,672,981 |
---
## Dataset Structure
### Fields
- `text` (`string`): The Basque Wikipedia plain text, at paragraph level.
- `phonemes` (`string`): The corresponding IPA phoneme transcription. Words are space-separated; punctuation is attached directly to the preceding word (e.g. `astr'onomia.` not `astr'onomia .`).
### Example
```python
from datasets import load_dataset
ds = load_dataset("HiTZ/wikipedia_basque_ipa", split="train")
print(ds[0]["text"])
# → "Historiako lehenengo zientzia izan da astronomia. Zibilizazio eta kultura guztiek..."
print(ds[0]["phonemes"])
# → "'istoɾiako le'enenɡo ʂi'entʂia iʂ'an da astr'onomia. ʂiβ'iliʂaʂio eta kult'uɾa..."
```
---
## IPA Symbol Conventions
This dataset uses **standard IPA** symbols.
---
## Data Processing Pipeline
Data processing steps from raw data extracted from Wikipedia to the phonemized utterances.
### Step 1 — Wikipedia Extraction (`WikiExtractor.py`)
Raw text was extracted from the Basque Wikipedia XML dump using a customized version of [WikiExtractor](https://github.com/attardi/wikiextractor). The extractor:
- Strips MediaWiki markup (templates, tables, infoboxes)
- Expands wiki links to their anchor text
- Removes HTML tags, comments, and special elements (`<ref>`, `<math>`, etc.)
- Replaces `<math>` blocks with `formula_N` placeholders
- Outputs plain paragraphs, one per line
### Step 2 — Cleaning
The extracted text was further cleaned with the following filters and transformations:
**Sentence-level filters (removal):**
- Sentences shorter than **100 characters**
- Sentences containing **double quotes** (`"`)
- Sentences containing **chess notation** (`e4`, `c4`)
- Sentences containing **HTML-like symbols** (`<`, `>`)
- Sentences containing the string **`formula kimikoa`** (Basque for "chemical formula")
- Sentences containing **`formula_N`** placeholders (Wikipedia math markup artifacts)
- Sentences containing **`|`** (MediaWiki pipe/table syntax artifacts)
- Sentences consisting **only of digits and punctuation**
**Text normalization transformations:**
- `"K. a."` → `"K.a."` and `"K. o."` → `"K.o."` (Basque grammatical abbreviations)
- Dots after single uppercase initials removed (e.g. `A.` → `A`)
- Content inside parentheses/brackets removed
- All bracket characters `[]<>{}()` removed
- Hyphens between words removed (e.g. `behaketa-saioa` → `behaketa saioa`), preserving numeric ranges
- Quotes and apostrophes (`"`, `'`, `"`, `"`, `'`, `'`) removed
- URLs and email addresses removed
- Non-printable characters removed
- Whitespace normalized (multiple spaces → single space)
- Consecutive or redundant punctuation cleaned up (e.g. `,,` → `,`, `..` → `.`)
- Trailing punctuation normalized to a single `.`
### Step 3 — Normalization + Phonemization
Each cleaned sentence was first **normalized** and then **phonemized** using **[ahoNT](https://github.com/hitz-zentroa/ahoNT)**, a Basque text processing and phonemization tool developed at HiTZ Zentroa / AhoLab.
**Normalization** handles:
- Number expansion (e.g. `42` → spoken Basque word form)
- Abbreviation resolution
- Other text-to-speech pre-processing rules specific to Basque
**Phonemization** then:
- Converts each normalized word to its phoneme sequence
- Outputs IPA symbols with stress markers and multicharacter affricates preserved
- Attaches punctuation marks to the preceding word
---
## Usage
```python
from datasets import load_dataset
ds = load_dataset("HiTZ/wikipedia_basque_ipa", split="train")
for example in ds.select(range(5)):
print(example["text"])
print(example["phonemes"])
print()
```
**Split phonemes into individual word tokens:**
```python
for example in ds.select(range(5)):
tokens = example["phonemes"].split()
print(tokens)
# e.g. ["'istoɾiako", "le'enenɡo", "ʂi'entʂia", "iʂ'an", "da", "astr'onomia.", ...]
```
**Use as a G2P training corpus:**
```python
for example in ds.select(range(5)):
words = example["text"].split()
phonemes = example["phonemes"].split()
# Note: words and phoneme tokens are aligned one-to-one
# (punctuation is attached to the preceding phoneme token)
```
---
## License
The dataset is derived from Basque Wikipedia, which is released under the [Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)](https://creativecommons.org/licenses/by-sa/4.0/) license.
---
## Citation
If you use this dataset, please cite the Basque Wikipedia and acknowledge the phonemization pipeline developed at AhoLab (University of the Basque Country).
## Related Resources
- **[ahoNT](https://github.com/hitz-zentroa/ahoNT)** — Basque text normalization and phonemization tool
- **[WikiExtractor](https://github.com/attardi/wikiextractor)** - Python script that extracts and cleans text from a Wikipedia database backup dump