|
|
|
|
|
|
|
""" |
|
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 |