dvoice-Darija / test.py
makiour's picture
dvoiceFinal
42a21dc
raw
history blame
768 Bytes
import os
import shutil
wavs_folder = 'audio/ar/train/ar_train_0'
test_folder = 'audio/ar/ar_train_0'
tsv_file = 'transcript/ar/train.tsv'
# Create the test folder if it doesn't exist
if not os.path.exists(test_folder):
os.makedirs(test_folder)
with open(tsv_file, 'r' ,encoding='utf-8') as f:
for line in f:
file_name = line.strip().split('\t')[0]
source_file_path = os.path.join(wavs_folder, file_name)
destination_file_path = os.path.join(test_folder, file_name)
if os.path.exists(source_file_path):
shutil.move(source_file_path, destination_file_path)
print(f"Moved {file_name} from {wavs_folder} to {test_folder}")
else:
print(f"File {file_name} not found in {wavs_folder}")