File size: 814 Bytes
f19472b
 
 
74f6e6f
 
 
 
 
 
60360c7
f19472b
 
 
40f3689
60360c7
f19472b
60360c7
 
 
 
 
40f3689
 
 
 
 
 
60360c7
40f3689
60360c7
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

# /mnt/y/ai/Genshin_Dataset/Genshin4.8_JP

# https://huggingface.co/docs/hub/datasets-file-names-and-splits
# metadata.jsonl
# β”œβ”€β”€ train.csv
# β”œβ”€β”€ test.csv
# └── validation.csv

import glob, os, re
from pathlib import Path
pth_wavs = glob.glob('/mnt/y/ai/Genshin_Dataset/Genshin4.8_JP/**/*.wav', recursive=True)

array = []

for pth_wav in pth_wavs:
	speaker = re.compile('Japanese\/(.+?)\/').search(pth_wav).group(1)
	speaker = re.compile('[#γ€Œγ€]').sub("", speaker)
	# if speaker != 'Unknown':
	# 	print(speaker)

	pth_lab = Path(os.path.dirname(pth_wav)) / (Path(pth_wav).stem +'.lab')
	if pth_lab.exists():
		with open(pth_lab.resolve(), encoding='utf-8') as f:
			s = f.read()
			s = s.strip()
			if s:
				array.append( { "wav": pth_wav, "speaker":speaker, "transcription":s } )
   
pass