Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support converting segmented DS files to CSV #9

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions variance-temp-solution/convert_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,10 @@ def ds2csv(ds_folder, transcription_file, curve_file, overwrite):
if not fp.with_suffix(".wav").exists():
with open(fp, "r", encoding="utf-8") as f:
ds = json.load(f)
for sub_ds in ds:
item_name = fp.stem + "_" + uuid.uuid4().hex[:3]
for _ in range(10):
if item_name not in curves:
break
item_name = fp.stem + "_" + uuid.uuid4().hex[:3]
else:
raise ValueError(f"Failed to generate a unique item name for {fp.stem}")
for idx, sub_ds in enumerate(ds):
item_name = f"{fp.stem}#{idx}"
if item_name in curves:
raise ValueError(f"{item_name} already exists.")
transcriptions.append(
{
"name": item_name,
Expand Down