File size: 1,261 Bytes
bed2cee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
"""Generate Lhotse CutSet files from recordings + supervisions manifests."""

from pathlib import Path
from lhotse import CutSet, load_manifest

# Configuration
manifest_dir = Path("/F00120240032/librispeech/corpus_librispeech/corpus/lhotse_format_manifests")
prefix = "librispeech"

# Define splits (adjust as needed)
splits = [
    "train-clean-100",
    "train-clean-360",
    "train-other-500",
    "dev-clean",
    "dev-other",
    "test-clean",
    "test-other",
]

for split in splits:
    rec_path = manifest_dir / f"{prefix}_recordings_{split}.jsonl.gz"
    sup_path = manifest_dir / f"{prefix}_supervisions_{split}.jsonl.gz"
    cut_path = manifest_dir / f"{prefix}_cutset_{split}.jsonl.gz"
    
    if not rec_path.exists():
        print(f"[SKIP] Recording manifest not found: {rec_path}")
        continue
    if not sup_path.exists():
        print(f"[SKIP] Supervision manifest not found: {sup_path}")
        continue
    
    print(f"Processing {split}...")
    cuts = CutSet.from_manifests(
        recordings=load_manifest(rec_path),
        supervisions=load_manifest(sup_path)
    )
    cuts.to_file(cut_path)
    print(f"  Saved: {cut_path} ({len(cuts)} cuts)")

print("\nDone! Generated cutset files for FastMSS.")