| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| """TODO: Add a description here.""" |
|
|
| import os |
| import csv |
| import json |
| import datasets |
| import pandas as pd |
| from scipy.io import wavfile |
|
|
|
|
| _CITATION = """\ |
| @inproceedings{Raju2022SnowMD, |
| title={Snow Mountain: Dataset of Audio Recordings of The Bible in Low Resource Languages}, |
| author={Kavitha Raju and V. Anjaly and R. Allen Lish and Joel Mathew}, |
| year={2022} |
| } |
| |
| """ |
|
|
| _DESCRIPTION = """\ |
| The Snow Mountain dataset contains the audio recordings (in .mp3 format) and the corresponding text of The Bible |
| in 11 Indian languages. The recordings were done in a studio setting by native speakers. Each language has a single |
| speaker in the dataset. Most of these languages are geographically concentrated in the Northern part of India around |
| the state of Himachal Pradesh. Being related to Hindi they all use the Devanagari script for transcription. |
| """ |
|
|
| _HOMEPAGE = "https://gitlabdev.bridgeconn.com/software/research/datasets/snow-mountain" |
|
|
| _LICENSE = "" |
|
|
| _URL = "https://gitlabdev.bridgeconn.com/software/research/datasets/snow-mountain/" |
|
|
| _FILES = { |
| "hindi": { |
| "train_500": "data/experiments/hindi/train_500.csv", |
| |
| |
| |
| |
| }, |
| |
| |
| |
| |
| |
| |
| |
| } |
|
|
|
|
| class Test(datasets.GeneratorBasedBuilder): |
|
|
| VERSION = datasets.Version("1.0.0") |
|
|
| BUILDER_CONFIGS = [ |
| datasets.BuilderConfig(name="hindi", version=VERSION, description="Hindi data"), |
| |
| ] |
|
|
| DEFAULT_CONFIG_NAME = "hindi" |
|
|
| def _info(self): |
| features = datasets.Features( |
| { |
| |
| "sentence": datasets.Value("string"), |
| "path": datasets.Value("string"), |
| "audio": datasets.Audio(sampling_rate=16_000), |
| } |
| ) |
| return datasets.DatasetInfo( |
| description=_DESCRIPTION, |
| features=features, |
| supervised_keys=("sentence", "path"), |
| homepage=_HOMEPAGE, |
| license=_LICENSE, |
| citation=_CITATION, |
| ) |
|
|
| def _split_generators(self, dl_manager): |
| |
| |
| |
| |
| |
| |
| |
| |
| downloaded_files = dl_manager.download(_FILES[self.config.name]) |
|
|
| train_splits = [ |
| datasets.SplitGenerator( |
| name="train_500", |
| gen_kwargs={ |
| "filepath": downloaded_files["train_500"], |
| }, |
| ), |
| |
| |
| |
| |
| |
| |
| ] |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| dev_splits = [] |
| test_splits = [] |
| |
| return train_splits + dev_splits + test_splits |
|
|
| |
| def _generate_examples(self, filepath): |
| key = 0 |
| cwd = os.getcwd()+'/' |
| with open(filepath) as f: |
| data_df = pd.read_csv(f,sep=',') |
| transcripts = [] |
| for index,row in data_df.iterrows(): |
| samplerate, audio_data = wavfile.read(row["path"]) |
| yield key, { |
| "sentence": row["sentence"], |
| "path": row["path"], |
| "audio":{"path": row["path"], "bytes": audio_data} |
| } |
| key+=1 |
|
|