upload
Browse files- audio.zip +3 -0
- datasets.py +102 -0
- text.zip +3 -0
audio.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:aee2ef74a325c60955ceea02ebf95b48c7acb6d9134e7a3407d01fef3df2d235
|
3 |
+
size 1900343
|
datasets.py
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
|
3 |
+
import csv
|
4 |
+
import os
|
5 |
+
import datasets
|
6 |
+
|
7 |
+
logger = datasets.logging.get_logger(__name__)
|
8 |
+
|
9 |
+
|
10 |
+
""" Self-use Dataset"""
|
11 |
+
|
12 |
+
_CITATION = """\
|
13 |
+
@article{nothing,
|
14 |
+
title={Self-use DataSets},
|
15 |
+
author={Stan}
|
16 |
+
journal={},
|
17 |
+
year={2023}
|
18 |
+
}
|
19 |
+
"""
|
20 |
+
|
21 |
+
_DESCRIPTION = """\
|
22 |
+
Self-use DataSets
|
23 |
+
"""
|
24 |
+
|
25 |
+
|
26 |
+
class Minds14Config(datasets.BuilderConfig):
|
27 |
+
"""BuilderConfig for xtreme-s"""
|
28 |
+
|
29 |
+
def __init__(
|
30 |
+
self, name, description, homepage, data_url
|
31 |
+
):
|
32 |
+
super(Minds14Config, self).__init__(
|
33 |
+
name=self.name,
|
34 |
+
version=datasets.Version("1.0.0", ""),
|
35 |
+
description=self.description,
|
36 |
+
)
|
37 |
+
self.name = name
|
38 |
+
self.description = description
|
39 |
+
self.homepage = homepage
|
40 |
+
self.data_url = data_url
|
41 |
+
|
42 |
+
|
43 |
+
class Minds14(datasets.GeneratorBasedBuilder):
|
44 |
+
|
45 |
+
DEFAULT_WRITER_BATCH_SIZE = 1000
|
46 |
+
|
47 |
+
def _info(self):
|
48 |
+
task_templates = None
|
49 |
+
features = datasets.Features(
|
50 |
+
{
|
51 |
+
"path": datasets.Value("string"),
|
52 |
+
"audio": datasets.Audio(sampling_rate=8_000),
|
53 |
+
"transcription": datasets.Value("string"),
|
54 |
+
}
|
55 |
+
)
|
56 |
+
|
57 |
+
return datasets.DatasetInfo(
|
58 |
+
description=_DESCRIPTION,
|
59 |
+
features=features,
|
60 |
+
supervised_keys=("audio", "transcription"),
|
61 |
+
homepage='',
|
62 |
+
citation=_CITATION,
|
63 |
+
task_templates=task_templates,
|
64 |
+
)
|
65 |
+
|
66 |
+
def _split_generators(self, dl_manager):
|
67 |
+
archive_path = dl_manager.download_and_extract(self.config.data_url)
|
68 |
+
audio_path = dl_manager.extract(
|
69 |
+
os.path.join(archive_path, "DataSets-0", "audio.zip")
|
70 |
+
)
|
71 |
+
text_path = dl_manager.extract(
|
72 |
+
os.path.join(archive_path, "DataSets-0", "text.zip")
|
73 |
+
)
|
74 |
+
|
75 |
+
text_path ={'demo': os.path.join(text_path, f"demo.csv")}
|
76 |
+
|
77 |
+
return [
|
78 |
+
datasets.SplitGenerator(
|
79 |
+
name=datasets.Split.TRAIN,
|
80 |
+
gen_kwargs={
|
81 |
+
"audio_path": audio_path,
|
82 |
+
"text_paths": text_path,
|
83 |
+
},
|
84 |
+
)
|
85 |
+
]
|
86 |
+
|
87 |
+
def _generate_examples(self, audio_path, text_paths):
|
88 |
+
key = 0
|
89 |
+
for lang in text_paths.keys():
|
90 |
+
text_path = text_paths[lang]
|
91 |
+
with open(text_path, encoding="utf-8") as csv_file:
|
92 |
+
csv_reader = csv.reader(csv_file, delimiter=",", skipinitialspace=True)
|
93 |
+
next(csv_reader)
|
94 |
+
for row in csv_reader:
|
95 |
+
filepath, refrence = row
|
96 |
+
filepath = os.path.join(audio_path, *filepath.split("/"))
|
97 |
+
yield key, {
|
98 |
+
"path": filepath,
|
99 |
+
"audio": filepath,
|
100 |
+
"transcription": refrence,
|
101 |
+
}
|
102 |
+
key += 1
|
text.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:91490053b1102c7f7376a5ae35565b07dec9df90406dc0770ecf30cdeb71dfbe
|
3 |
+
size 1556
|