| --- |
| language: |
| - ur |
| license: mit |
| task_categories: |
| - audio-classification |
| tags: |
| - urdu |
| - turn-detection |
| - voice-activity-detection |
| - conversational-ai |
| - end-of-turn |
| - smart-turn |
| - audio |
| - dataset |
| --- |
| |
| # 🗣️ Urdu Turn Detection (Audio Dataset V2) |
|
|
| This is the official dataset for the model **[PuristanLabs1/urdu-turn-v2]**(https://huggingface.co/PuristanLabs1/urdu-turn-v2), a high precision, low latency system for detecting the end of a conversational turn in Urdu speech. |
|
|
| It contains **11,479 audio clips** (balanced between `Complete` and `Incomplete`) specifically designed to train robust models for realtime Voice AI applications like "Smart Turn" or "Barge-in" detection. |
|
|
| ## 🚀 How This Dataset Was Compiled |
|
|
| The creation of this dataset involved a multi stage pipeline combining human validated Urdu text, synthetic dialogue generation, and advanced acoustic augmentation. |
|
|
| ### 1. The Core Text Corpus (10,000 Samples) |
| - **Source**: 2,825 human validated Urdu sentences (Gold Standard) combined with 7,175 synthetic samples generated by **Google Gemini 2.5 Flash Lite**. |
| - **Diversity**: Covers daily life, news, formal requests, and casual "thinking out loud" scenarios. |
| - **Language**: 100% Urdu script (Nastaliq/Arabic), strictly filtered to remove English or Roman Urdu artifacts. |
|
|
| ### 2. Acoustic Realization (VAD Prep) |
| - We converted the text into audio using high quality Urdu TTS endpoints. |
| - Each sentence was transformed into a 16kHz mono `.wav` file. |
| - **Problem**: Standard TTS audio ends perfectly. To simulate realworld speech, we needed to simulate "trailing off." |
|
|
| ### 3. Negative Sampling & Truncation |
| To teach the model what an **Incomplete** turn sounds like, we implemented a strategic truncation algorithm: |
| - **Full Clips (Label 1)**: Sentences played to completion with natural closure. |
| - **Truncated Clips (Label 0)**: Sentences cut off mid-phrase at semantic boundaries (e.g., stopping after "میں..." or "اگر وہ..."). This forces the model to learn the prosodic and phonetic cues of a non-terminal sound. |
|
|
| ### 4. Fixing the "Silence Bias" (V2 Upgrade) |
| A critical step taken was the injection of **Synthetic Silence & Thinking Noise**: |
| - **Silence Injection**: Added 1,500+ clips of pure, varied energy silence labeled as **Incomplete (0)**. |
| - **Strategic Truncation**: Sentences were cut off mid phrase at semantic boundaries to create negative samples. |
| - **Thinking Noise**: Injected "hmmm" and "uhh" fillers to ensure the model doesn't trigger a turn end just because the speaker is thinking. Basically Pure silence and "thinking noise" (umms/ahhs) were labeled as **Incomplete (0)** to prevent false triggers during pauses. |
| - **Padding Masking**: All audio is padded to 3.0 seconds, with an explicit `attention_mask` generated to teach the model to ignore non-voice segments. |
| - **Gemini 2.5 Augmentation**: Synthetic dialogues were generated to broaden the linguistic variety beyond standard text corpora. |
|
|
| ## 📊 Dataset Statistics |
|
|
| | Feature | Details | |
| | :--- | :--- | |
| | **Total Clips**| 11,479 | |
| | **Sampling Rate** | 16,000 Hz | |
| | **Format** | Mono WAV / PCM_16(WebDataset TAR Shards) | |
| | **Labels** | `0: INCOMPLETE`, `1: COMPLETE` | |
| | **Avg Duration** | 2.5 seconds | |
| | **Balance** | 57% Complete (6,539) / 43% Incomplete (4,940) | |
| |
| ## 📁 Repository Structure |
| |
| The dataset is stored in **WebDataset** format (TAR shards) for optimal streaming: |
| - `train-0000.tar` to `train-0005.tar`: Audio shards. |
| - `metadata.csv`: Combined metadata. |
| - Each sample inside a shard contains: |
| - `XXXX.wav`: Audio clip. |
| - `XXXX.txt`: Urdu transcription. |
| - `XXXX.cls`: Label (0 or 1). |
| |
| ## 🛠️ Installation & Usage |
| |
| ### ⚙️ Dependencies (Crucial for Windows) |
| |
| The `datasets` library uses `torchcodec` for audio decoding. **Windows users often face issues** because `torchcodec` depends on FFmpeg DLLs. |
| |
| #### 1. Install Python Packages: |
| ```bash |
| pip install datasets librosa torchcodec |
| or |
| |
| !pip install -q datasets[audio] librosa Transformers |
| |
| ``` |
| |
| #### 2. Install FFmpeg (Required for Windows): |
| If you see `ImportError: To support decoding audio data, please install 'torchcodec'` or `invalid header` errors: |
| - **Using Chocolatey**: `choco install ffmpeg-full` |
| - **Manual**: Download the "full-shared" build from [gyan.dev](https://www.gyan.dev/ffmpeg/builds/), extract it, and add the `bin` folder to your System PATH. |
| |
| --- |
| |
| ## 🚀 Loading the Dataset |
| |
| ### Option 1: Streaming Mode (Recommended) |
| This is the fastest way to start. It fetches audio on the fly without downloading the whole 1GB archive. |
| |
| ```python |
| from datasets import load_dataset |
| import io |
| import librosa |
|
|
| # Load in streaming mode |
| ds = load_dataset("PuristanLabs1/urdu-turn-detection-audio-v2", streaming=True, split="train") |
| |
| for sample in ds.take(5): |
| # Access audio data |
| audio_array = sample["wav"]["array"] |
| sampling_rate = sample["wav"]["sampling_rate"] |
| |
| # Access metadata |
| text = sample["txt"] |
| label = int(sample["cls"]) # 0: Incomplete, 1: Complete |
| |
| print(f"Text: {text} | Label: {label}") |
| |
| ### 🔊 Playing the Audio |
|
|
| Once you have the `audio_array` from the sample: |
|
|
| #### **On Google Colab:** |
| ```python |
| import IPython.display as ipd |
| ipd.display(ipd.Audio(audio_array, rate=sampling_rate)) |
| ``` |
|
|
| #### **On Local Machine (Laptop):** |
| * **Windows**: `pip install sounddevice` |
| * **Linux (Ubuntu/Debian)**: `sudo apt-get install libportaudio2` then `pip install sounddevice` |
| ```python |
| import sounddevice as sd |
| sd.play(audio_array, sampling_rate) |
| sd.wait() # Wait for audio to finish |
| ``` |
|
|
| ### **Option 2: Full Download** |
| Download the entire dataset for offline training. |
| ```python |
| from datasets import load_dataset |
| |
| ds = load_dataset("PuristanLabs1/urdu-turn-detection-audio-v2") |
| print(f"Total samples: {len(ds['train'])}") |
| ``` |
|
|
| --- |
|
|
| ## 🤝 Acknowledgments & Credits |
|
|
| - **Curated By**: [PuristanLabs](https://huggingface.co/PuristanLabs1). |
| - **Base Audio**: Custom TTS on our [PuristanLabs1/Urdu-Turn-Detection-10k](https://huggingface.co/datasets/PuristanLabs1/Urdu-Turn-Detection-10k) & Common Voice 13 (Urdu Subset) |
| - **Augmentation**: Synthetic generation via Google Gemini 2.5. |
| - **Core Engine**: Optimized for the [`urdu-turn-detector`](https://github.com/PuristanLabs1/urdu-turn-detection) library. |
|
|
| --- |
| **License**: MIT. Free for research and commercial use. |
|
|