File size: 1,221 Bytes
f4eaef9
8b751a8
 
0b38772
 
 
 
 
 
 
 
 
 
1d399e7
 
 
f4eaef9
1d399e7
f4eaef9
1d399e7
6f6a69c
 
 
 
1d399e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

# Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s

"""
rm -rf ~/.cache/huggingface/datasets/dlxjj___common_voice_17_0 && 
rm -rf ~/.cache/huggingface/modules/datasets_modules/datasets/dlxjj--common_voice_17_0 && 
rm -rf ~/.cache/huggingface/modules/datasets_modules/datasets/dlxjj--common_voice_17_0.lock && 
rm -rf ~/.cache/huggingface/datasets/downloads && 
rm -rf ~/.cache/huggingface/hub/datasets--dlxjj--common_voice_17_0

"""
	# 更新数据集后先删除缓存

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 idx, pth_wav in enumerate(pth_wavs):
    
	if "带变量语音" in pth_wav:
		continue
    
	speaker = re.compile('Japanese\/(.+?)\/').search(pth_wav).group(1)
	speaker = re.compile('[#「」]').sub("", 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 } )
	
	if (idx+1) % 100 == 0:
		print( f"{idx+1} / {len(pth_wavs)}" )
		break
 
pass