Convert dataset to Parquet

#10
by lhoestq HF Staff - opened
README.md CHANGED
@@ -18,22 +18,8 @@ source_datasets:
18
  task_categories:
19
  - automatic-speech-recognition
20
  task_ids: []
21
- train-eval-index:
22
- - config: clean
23
- task: automatic-speech-recognition
24
- task_id: speech_recognition
25
- splits:
26
- train_split: train
27
- eval_split: test
28
- col_mapping:
29
- file: path
30
- text: text
31
- metrics:
32
- - type: wer
33
- name: WER
34
- - type: cer
35
- name: CER
36
  dataset_info:
 
37
  features:
38
  - name: file
39
  dtype: string
@@ -47,16 +33,38 @@ dataset_info:
47
  dtype: string
48
  - name: orthographic
49
  dtype: string
50
- config_name: clean
51
  splits:
52
  - name: train
53
- num_bytes: 1002365
54
  num_examples: 1813
55
  - name: test
56
- num_bytes: 65784
57
  num_examples: 100
58
- download_size: 1192302846
59
- dataset_size: 1068149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  ---
61
 
62
  # Dataset Card for Arabic Speech Corpus
 
18
  task_categories:
19
  - automatic-speech-recognition
20
  task_ids: []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  dataset_info:
22
+ config_name: clean
23
  features:
24
  - name: file
25
  dtype: string
 
33
  dtype: string
34
  - name: orthographic
35
  dtype: string
 
36
  splits:
37
  - name: train
38
+ num_bytes: 1527541662.966
39
  num_examples: 1813
40
  - name: test
41
+ num_bytes: 99835729.0
42
  num_examples: 100
43
+ download_size: 1347581073
44
+ dataset_size: 1627377391.966
45
+ configs:
46
+ - config_name: clean
47
+ data_files:
48
+ - split: train
49
+ path: clean/train-*
50
+ - split: test
51
+ path: clean/test-*
52
+ default: true
53
+ train-eval-index:
54
+ - config: clean
55
+ task: automatic-speech-recognition
56
+ task_id: speech_recognition
57
+ splits:
58
+ train_split: train
59
+ eval_split: test
60
+ col_mapping:
61
+ file: path
62
+ text: text
63
+ metrics:
64
+ - type: wer
65
+ name: WER
66
+ - type: cer
67
+ name: CER
68
  ---
69
 
70
  # Dataset Card for Arabic Speech Corpus
arabic_speech_corpus.py DELETED
@@ -1,143 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2021 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
-
16
- # Lint as: python3
17
- """Arabic Speech Corpus"""
18
-
19
-
20
- import os
21
-
22
- import datasets
23
-
24
-
25
- _CITATION = """\
26
- @phdthesis{halabi2016modern,
27
- title={Modern standard Arabic phonetics for speech synthesis},
28
- author={Halabi, Nawar},
29
- year={2016},
30
- school={University of Southampton}
31
- }
32
- """
33
-
34
- _DESCRIPTION = """\
35
- This Speech corpus has been developed as part of PhD work carried out by Nawar Halabi at the University of Southampton.
36
- The corpus was recorded in south Levantine Arabic
37
- (Damascian accent) using a professional studio. Synthesized speech as an output using this corpus has produced a high quality, natural voice.
38
- Note that in order to limit the required storage for preparing this dataset, the audio
39
- is stored in the .flac format and is not converted to a float32 array. To convert, the audio
40
- file to a float32 array, please make use of the `.map()` function as follows:
41
-
42
-
43
- ```python
44
- import soundfile as sf
45
-
46
- def map_to_array(batch):
47
- speech_array, _ = sf.read(batch["file"])
48
- batch["speech"] = speech_array
49
- return batch
50
-
51
- dataset = dataset.map(map_to_array, remove_columns=["file"])
52
- ```
53
- """
54
-
55
- _URL = "http://en.arabicspeechcorpus.com/arabic-speech-corpus.zip"
56
-
57
-
58
- class ArabicSpeechCorpusConfig(datasets.BuilderConfig):
59
- """BuilderConfig for ArabicSpeechCorpu."""
60
-
61
- def __init__(self, **kwargs):
62
- """
63
- Args:
64
- data_dir: `string`, the path to the folder containing the files in the
65
- downloaded .tar
66
- citation: `string`, citation for the data set
67
- url: `string`, url for information about the data set
68
- **kwargs: keyword arguments forwarded to super.
69
- """
70
- super(ArabicSpeechCorpusConfig, self).__init__(version=datasets.Version("2.1.0", ""), **kwargs)
71
-
72
-
73
- class ArabicSpeechCorpus(datasets.GeneratorBasedBuilder):
74
- """ArabicSpeechCorpus dataset."""
75
-
76
- BUILDER_CONFIGS = [
77
- ArabicSpeechCorpusConfig(name="clean", description="'Clean' speech."),
78
- ]
79
-
80
- def _info(self):
81
- return datasets.DatasetInfo(
82
- description=_DESCRIPTION,
83
- features=datasets.Features(
84
- {
85
- "file": datasets.Value("string"),
86
- "text": datasets.Value("string"),
87
- "audio": datasets.Audio(sampling_rate=48_000),
88
- "phonetic": datasets.Value("string"),
89
- "orthographic": datasets.Value("string"),
90
- }
91
- ),
92
- supervised_keys=("file", "text"),
93
- homepage=_URL,
94
- citation=_CITATION,
95
- )
96
-
97
- def _split_generators(self, dl_manager):
98
- archive_path = dl_manager.download_and_extract(_URL)
99
- archive_path = os.path.join(archive_path, "arabic-speech-corpus")
100
- return [
101
- datasets.SplitGenerator(name="train", gen_kwargs={"archive_path": archive_path}),
102
- datasets.SplitGenerator(name="test", gen_kwargs={"archive_path": os.path.join(archive_path, "test set")}),
103
- ]
104
-
105
- def _generate_examples(self, archive_path):
106
- """Generate examples from a Librispeech archive_path."""
107
- lab_dir = os.path.join(archive_path, "lab")
108
- wav_dir = os.path.join(archive_path, "wav")
109
- if "test set" in archive_path:
110
- phonetic_path = os.path.join(archive_path, "phonetic-transcript.txt")
111
- else:
112
- phonetic_path = os.path.join(archive_path, "phonetic-transcipt.txt")
113
-
114
- orthographic_path = os.path.join(archive_path, "orthographic-transcript.txt")
115
-
116
- phonetics = {}
117
- orthographics = {}
118
-
119
- with open(phonetic_path, "r", encoding="utf-8") as f:
120
- for line in f:
121
- wav_file, phonetic = line.split('"')[1::2]
122
- phonetics[wav_file] = phonetic
123
-
124
- with open(orthographic_path, "r", encoding="utf-8") as f:
125
- for line in f:
126
- wav_file, orthographic = line.split('"')[1::2]
127
- orthographics[wav_file] = orthographic
128
-
129
- for _id, lab_name in enumerate(sorted(os.listdir(lab_dir))):
130
- lab_path = os.path.join(lab_dir, lab_name)
131
- lab_text = open(lab_path, "r", encoding="utf-8").read()
132
-
133
- wav_name = lab_name[:-4] + ".wav"
134
- wav_path = os.path.join(wav_dir, wav_name)
135
-
136
- example = {
137
- "file": wav_path,
138
- "audio": wav_path,
139
- "text": lab_text,
140
- "phonetic": phonetics[wav_name],
141
- "orthographic": orthographics[wav_name],
142
- }
143
- yield str(_id), example
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
clean/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b8241b2745f1bbce0c6de34b02bcfe9a9804cd080e7c9e5a2f35be220199b6c
3
+ size 90895521
clean/train-00000-of-00004.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4dd8a7c037e6b3257e4b69b884d8012f7eb96e00dd10f442aaa1943ace840a4
3
+ size 398877758
clean/train-00001-of-00004.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:829c4cb8acf742e31cb2af0ed932647cfa6e1c261bad03e6511dd690efaca233
3
+ size 322749436
clean/train-00002-of-00004.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7cb2613d3be1ae491f4a7d6bd3cb9fe8220f46daa7a8a8e8c518dd36424d6df1
3
+ size 291780398
clean/train-00003-of-00004.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a7ec2452dde695b64a02f3213b95b28e5654b61381ed9e6a6444590d5ea52b8
3
+ size 243277960