#!/usr/bin/env python3 INPUT_FILE = "fashion_train.txt" OUTPUT_FILE = "fashion.txt" def main(): out_lines = [] with open(INPUT_FILE, "r", encoding="utf-8") as f: for line in f: line = line.rstrip("\n") if not line.strip(): continue parts = line.split("|") # Expecting: path | phonemes | speaker_id | text if len(parts) == 4: path, phonemes, speaker_id, text = parts new_line = f"{path}|{phonemes}|{speaker_id}|0|{text}" out_lines.append(new_line) else: # If unexpected format, keep line as-is out_lines.append(line) with open(OUTPUT_FILE, "w", encoding="utf-8") as f: for l in out_lines: f.write(l + "\n") print(f"✅ Added language column successfully → {OUTPUT_FILE}") if __name__ == "__main__": main()