File size: 929 Bytes
fb0011a | 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 | #!/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()
|