iulik-pisik
commited on
Commit
•
e50c84a
1
Parent(s):
c21e0e3
Delete horoscop_neti.py
Browse files- horoscop_neti.py +0 -60
horoscop_neti.py
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
from datasets import DatasetBuilder, DatasetInfo, SplitGenerator, Split, Features, Value, Version, Audio
|
2 |
-
import os
|
3 |
-
|
4 |
-
class HoroscopNetiDataset(DatasetBuilder):
|
5 |
-
VERSION = Version("1.0.0")
|
6 |
-
|
7 |
-
def _info(self):
|
8 |
-
return DatasetInfo(
|
9 |
-
description="Descrierea datasetului tău.",
|
10 |
-
features=Features({
|
11 |
-
"audio": Audio(sampling_rate=16000),
|
12 |
-
"transcript": Value("string"),
|
13 |
-
}),
|
14 |
-
supervised_keys=None,
|
15 |
-
homepage="https://huggingface.co/datasets/iulik-pisik/horoscop-neti",
|
16 |
-
citation="Referința de citare a datasetului",
|
17 |
-
)
|
18 |
-
|
19 |
-
def _split_generators(self, dl_manager):
|
20 |
-
base_path = os.path.abspath(os.path.dirname(__file__))
|
21 |
-
|
22 |
-
return [
|
23 |
-
SplitGenerator(
|
24 |
-
name=Split.TRAIN,
|
25 |
-
gen_kwargs={
|
26 |
-
"audio_dir": os.path.join(base_path, "audio/train"),
|
27 |
-
"transcript_dir": os.path.join(base_path, "transcript/train"),
|
28 |
-
},
|
29 |
-
),
|
30 |
-
SplitGenerator(
|
31 |
-
name=Split.TEST,
|
32 |
-
gen_kwargs={
|
33 |
-
"audio_dir": os.path.join(base_path, "audio/test"),
|
34 |
-
"transcript_dir": os.path.join(base_path, "transcript/test"),
|
35 |
-
},
|
36 |
-
),
|
37 |
-
SplitGenerator(
|
38 |
-
name=Split.VALIDATION,
|
39 |
-
gen_kwargs={
|
40 |
-
"audio_dir": os.path.join(base_path, "audio/validation"),
|
41 |
-
"transcript_dir": os.path.join(base_path, "transcript/validation"),
|
42 |
-
},
|
43 |
-
),
|
44 |
-
]
|
45 |
-
|
46 |
-
def _generate_examples(self, audio_dir, transcript_dir):
|
47 |
-
for transcript_path in os.listdir(transcript_dir):
|
48 |
-
transcript_file = os.path.join(transcript_dir, transcript_path)
|
49 |
-
audio_file = os.path.join(audio_dir, transcript_path.replace(".txt", ".wav"))
|
50 |
-
|
51 |
-
if os.path.isfile(transcript_file) and os.path.isfile(audio_file):
|
52 |
-
with open(transcript_file, "r", encoding="utf-8") as f:
|
53 |
-
transcript = f.read().strip()
|
54 |
-
|
55 |
-
example_id = os.path.splitext(transcript_path)[0]
|
56 |
-
|
57 |
-
yield example_id, {
|
58 |
-
"audio": audio_file,
|
59 |
-
"transcript": transcript,
|
60 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|