- Fixed sentence loading
Browse files- .gitignore +6 -0
- dv-presidential-speech.py +3 -4
.gitignore
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
venv/
|
2 |
+
env/
|
3 |
+
.env
|
4 |
+
__pycache__/fi
|
5 |
+
scripts/__pycache__/
|
6 |
+
/.idea
|
dv-presidential-speech.py
CHANGED
@@ -130,12 +130,12 @@ class DhivehiPresidentialSpeech(datasets.GeneratorBasedBuilder):
|
|
130 |
data_fields = list(self._info().features.keys())
|
131 |
metadata = {}
|
132 |
with open(metadata_path, 'r', encoding='utf-8') as f:
|
133 |
-
reader = csv.reader(f)
|
134 |
-
row_dict = {}
|
135 |
|
136 |
for row in reader:
|
|
|
137 |
row_dict['path'] = row[0]
|
138 |
-
row_dict['sentence'] = row[1]
|
139 |
|
140 |
# if data is incomplete, fill with empty values
|
141 |
for field in data_fields:
|
@@ -147,7 +147,6 @@ class DhivehiPresidentialSpeech(datasets.GeneratorBasedBuilder):
|
|
147 |
id_ = 0
|
148 |
for path, f in audio_files:
|
149 |
file_name = os.path.splitext(os.path.basename(path))[0]
|
150 |
-
os.path.join(path_to_clips, row[0])
|
151 |
|
152 |
if file_name in metadata:
|
153 |
result = dict(metadata[file_name])
|
|
|
130 |
data_fields = list(self._info().features.keys())
|
131 |
metadata = {}
|
132 |
with open(metadata_path, 'r', encoding='utf-8') as f:
|
133 |
+
reader = csv.reader(f, delimiter=',', quotechar='"')
|
|
|
134 |
|
135 |
for row in reader:
|
136 |
+
row_dict = {}
|
137 |
row_dict['path'] = row[0]
|
138 |
+
row_dict['sentence'] = str(len(row[1]))
|
139 |
|
140 |
# if data is incomplete, fill with empty values
|
141 |
for field in data_fields:
|
|
|
147 |
id_ = 0
|
148 |
for path, f in audio_files:
|
149 |
file_name = os.path.splitext(os.path.basename(path))[0]
|
|
|
150 |
|
151 |
if file_name in metadata:
|
152 |
result = dict(metadata[file_name])
|