albertvillanova HF staff commited on
Commit
be547dd
1 Parent(s): b65b9bb

Delete loading script

Browse files
Files changed (1) hide show
  1. ASCEND.py +0 -139
ASCEND.py DELETED
@@ -1,139 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor.
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
- """ Common Voice Dataset"""
16
-
17
- from datasets import AutomaticSpeechRecognition
18
-
19
-
20
- import datasets
21
- import os
22
- import pandas as pd
23
-
24
-
25
- _CITATION = """\
26
- @inproceedings{lovenia2021ascend,
27
- title = {ASCEND: A Spontaneous Chinese-English Dataset for Code-switching in Multi-turn Conversation},
28
- author = {Lovenia, Holy and Cahyawijaya, Samuel and Winata, Genta Indra and Xu, Peng and Yan, Xu and Liu, Zihan and Frieske, Rita and Yu, Tiezheng and Dai, Wenliang and Barezi, Elham J and others},
29
- booktitle = {Proceedings of the International Conference on Language Resources and Evaluation, {LREC} 2022, 20-25 June 2022, Lu Palais du Pharo, France},
30
- publisher = {European Language Resources Association},
31
- year = {2022},
32
- pages = {}
33
- }
34
- """
35
-
36
- _DESCRIPTION = """\
37
- ASCEND (A Spontaneous Chinese-English Dataset) introduces a high-quality resource of spontaneous multi-turn conversational dialogue Chinese-English code-switching corpus collected in Hong Kong. ASCEND consists of 10.62 hours of spontaneous speech with a total of ~12.3K utterances. The corpus is split into 3 sets: training, validation, and test with a ratio of 8:1:1 while maintaining a balanced gender proportion on each set.
38
- """
39
-
40
- _HOMEPAGE = "https://huggingface.co/datasets/CAiRE/ASCEND"
41
-
42
- _URL = "https://huggingface.co/datasets/CAiRE/ASCEND/raw/main/"
43
- _URLS = {
44
- "train": _URL + "train_metadata.csv",
45
- "test": _URL + "test_metadata.csv",
46
- "validation": _URL + "validation_metadata.csv",
47
- "waves": "https://huggingface.co/datasets/CAiRE/ASCEND/resolve/main/waves.tar.bz2",
48
- }
49
-
50
-
51
- class ASCENDConfig(datasets.BuilderConfig):
52
- """BuilderConfig for ASCEND."""
53
-
54
- def __init__(self, name="main", **kwargs):
55
- """
56
- Args:
57
- **kwargs: keyword arguments forwarded to super.
58
- """
59
- super(ASCENDConfig, self).__init__(name, **kwargs)
60
-
61
-
62
- class ASCEND(datasets.GeneratorBasedBuilder):
63
- """ASCEND: A Spontaneous Chinese-English Dataset for code-switching. Snapshot date: 5 January 2022."""
64
-
65
- BUILDER_CONFIGS = [
66
- ASCENDConfig(
67
- name="main",
68
- version=datasets.Version("1.0.0", ""),
69
- description=_DESCRIPTION,
70
- )
71
- ]
72
-
73
- def _info(self):
74
- features = datasets.Features(
75
- {
76
- "id": datasets.Value("string"),
77
- "path": datasets.Value("string"),
78
- "audio": datasets.Audio(sampling_rate=16_000),
79
- "transcription": datasets.Value("string"),
80
- "duration": datasets.Value("float32"),
81
- "language": datasets.Value("string"),
82
- "original_speaker_id": datasets.Value("int64"),
83
- "session_id": datasets.Value("int64"),
84
- "topic": datasets.Value("string"),
85
- }
86
- )
87
- return datasets.DatasetInfo(
88
- description=_DESCRIPTION,
89
- features=features,
90
- supervised_keys=None,
91
- homepage=_HOMEPAGE,
92
- citation=_CITATION,
93
- task_templates=[AutomaticSpeechRecognition(audio_column="audio", transcription_column="transcription")],
94
- )
95
-
96
- def _split_generators(self, dl_manager):
97
- downloaded_files = dl_manager.download_and_extract(_URLS)
98
-
99
- return [
100
- datasets.SplitGenerator(
101
- name=datasets.Split.TRAIN,
102
- gen_kwargs={
103
- "metadata_path": downloaded_files["train"],
104
- "wave_path": downloaded_files["waves"],
105
- },
106
- ),
107
- datasets.SplitGenerator(
108
- name=datasets.Split.TEST,
109
- gen_kwargs={
110
- "metadata_path": downloaded_files["test"],
111
- "wave_path": downloaded_files["waves"],
112
- },
113
- ),
114
- datasets.SplitGenerator(
115
- name=datasets.Split.VALIDATION,
116
- gen_kwargs={
117
- "metadata_path": downloaded_files["validation"],
118
- "wave_path": downloaded_files["waves"],
119
- },
120
- ),
121
- ]
122
-
123
- def _generate_examples(self, metadata_path, wave_path):
124
- print(metadata_path)
125
- metadata_df = pd.read_csv(metadata_path)
126
-
127
- for index, row in metadata_df.iterrows():
128
- example = {
129
- "id": str(index).zfill(5),
130
- "path": os.path.join(wave_path, row["file_name"]),
131
- "audio": os.path.join(wave_path, row["file_name"]),
132
- "transcription": row["transcription"],
133
- "duration": row["duration"],
134
- "language": row["language"],
135
- "original_speaker_id": row["original_speaker_id"],
136
- "session_id": row["session_id"],
137
- "topic": row["topic"],
138
- }
139
- yield index, example