Vladislav Sokolovskii
commited on
Commit
•
e472375
1
Parent(s):
8da16ae
Debug file creation was deleted
Browse filesSigned-off-by: Vladislav Sokolovskii <[email protected]>
- voxceleb/voxceleb.py +30 -33
- voxpopuli/voxpopuli.py +30 -33
voxceleb/voxceleb.py
CHANGED
@@ -158,37 +158,34 @@ class SLUEVoxceleb(datasets.GeneratorBasedBuilder):
|
|
158 |
# read tsv file by rows
|
159 |
with open(filepath, encoding="utf-8") as f:
|
160 |
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
"end_second": float(row["end_second"]),
|
192 |
-
"audio_path": os.path.join(audio_dir, audio_file),
|
193 |
-
}
|
194 |
|
|
|
158 |
# read tsv file by rows
|
159 |
with open(filepath, encoding="utf-8") as f:
|
160 |
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
161 |
+
for row in reader:
|
162 |
+
speaker_id = row["speaker_id"]
|
163 |
+
if not speaker_id.isdigit():
|
164 |
+
speaker_id = -1
|
165 |
+
else:
|
166 |
+
speaker_id = int(speaker_id)
|
167 |
+
|
168 |
+
audio_file = f"{row['id']}.flac"
|
169 |
+
if split == "test-blind":
|
170 |
+
yield row["id"], {
|
171 |
+
"id": row["id"],
|
172 |
+
"normalized_text": None,
|
173 |
+
"speaker_id": speaker_id,
|
174 |
+
"split": split,
|
175 |
+
"sentiment": None,
|
176 |
+
"start_second": float(row["start_second"]),
|
177 |
+
"end_second": float(row["end_second"]),
|
178 |
+
"audio_path": os.path.join(audio_dir, audio_file),
|
179 |
+
}
|
180 |
+
elif split == "fine-tune" or split == "dev":
|
181 |
+
yield row["id"], {
|
182 |
+
"id": row["id"],
|
183 |
+
"normalized_text": row["normalized_text"],
|
184 |
+
"speaker_id": speaker_id,
|
185 |
+
"split": split,
|
186 |
+
"sentiment": row["sentiment"],
|
187 |
+
"start_second": float(row["start_second"]),
|
188 |
+
"end_second": float(row["end_second"]),
|
189 |
+
"audio_path": os.path.join(audio_dir, audio_file),
|
190 |
+
}
|
|
|
|
|
|
|
191 |
|
voxpopuli/voxpopuli.py
CHANGED
@@ -158,37 +158,34 @@ class SLUEVoxpopuli(datasets.GeneratorBasedBuilder):
|
|
158 |
# read tsv file by rows
|
159 |
with open(filepath, encoding="utf-8") as f:
|
160 |
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
"normalized_ner": row["normalized_ner"],
|
192 |
-
"audio_path": os.path.join(audio_dir, audio_file),
|
193 |
-
}
|
194 |
|
|
|
158 |
# read tsv file by rows
|
159 |
with open(filepath, encoding="utf-8") as f:
|
160 |
reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
161 |
+
for row in reader:
|
162 |
+
speaker_id = row["speaker_id"]
|
163 |
+
if not speaker_id.isdigit():
|
164 |
+
speaker_id = -1
|
165 |
+
else:
|
166 |
+
speaker_id = int(speaker_id)
|
167 |
+
|
168 |
+
audio_file = f"{row['id']}.ogg"
|
169 |
+
if split == "test-blind":
|
170 |
+
yield row["id"], {
|
171 |
+
"id": row["id"],
|
172 |
+
"raw_text": row["raw_text"],
|
173 |
+
"normalized_text": row["normalized_text"],
|
174 |
+
"speaker_id": speaker_id,
|
175 |
+
"split": split,
|
176 |
+
"audio_path": os.path.join(audio_dir, audio_file),
|
177 |
+
"raw_ner": None,
|
178 |
+
"normalized_ner": None
|
179 |
+
}
|
180 |
+
elif split == "fine-tune" or split == "dev":
|
181 |
+
yield row["id"], {
|
182 |
+
"id": row["id"],
|
183 |
+
"raw_text": row["raw_text"],
|
184 |
+
"normalized_text": row["normalized_text"],
|
185 |
+
"speaker_id": speaker_id,
|
186 |
+
"split": split,
|
187 |
+
"raw_ner": row["raw_ner"],
|
188 |
+
"normalized_ner": row["normalized_ner"],
|
189 |
+
"audio_path": os.path.join(audio_dir, audio_file),
|
190 |
+
}
|
|
|
|
|
|
|
191 |
|