|
提取AISHELL-1输入输出
【1】采用halcon进行提取
- dev_update_off()
- dev_set_draw('margin')
- pathwav:='D:/2-LearningCode/902-ASR/AISHELL-1/data_aishell/wav/train'
- pathtrans := 'D:/2-LearningCode/902-ASR/AISHELL-1/data_aishell/transcript'
- pathtranscript:='D:/2-LearningCode/902-ASR/AISHELL-1/data_aishell/transcript/aishell_transcript_v0.8.txt'
- pathtranscriptWords := []
- open_file (pathtranscript, 'input', FileHandle)
- IsEOF := 0
- nums := []
- k:=0
- while (IsEOF == 0)
- fread_line (FileHandle, Number, IsEOF)
- pathtranscriptWords[k] := Number
- k:=k+1
- endwhile
- close_file (FileHandle)
- *
- WavInputOut := ''
- list_files(pathwav, 'directories', Files)
- for i:= 0 to |Files|-1 by 1
- FilePath:=Files[i]
- list_image_files(FilePath, 'wav', [], WavFiles)
- for j:= 0 to |WavFiles|-1 by 1
- WavFile := WavFiles[j]
- tuple_split(WavFile, '/', Substrings)
- WavNameExt := Substrings[|Substrings|-1]
- tuple_split(WavNameExt, '.wav', Substrings1)
- WavName:= Substrings1[0]
- * 在pathtranscript里面查找对应的wav对应的输出
- WavNameOutput := ''
- for k:=0 to |pathtranscriptWords|-1 by 1
- scriptWord := pathtranscriptWords[k]
- tuple_split(scriptWord, ' ', Substrings2)
- tuple_length(Substrings2, Length1)
- if(Length1>0)
- if(Substrings2[0]==WavName)
- tuple_split(scriptWord, WavName, Substrings3)
- tuple_strlen(Substrings3, Length)
- tuple_substr(Substrings3, 1, Length-1, Substring)
- WavNameOutput := Substring
- break
- endif
- endif
- endfor
- WriteTxt (FilePath + WavName + '.txt', WavNameOutput)
- WavInputOut := WavInputOut + WavFile + ',' + FilePath + WavName + '.txt' + '\n'
- endfor
- endfor
- *
- resPath := 'D:/2-LearningCode/902-ASR/AISHELL-1/data_aishell/'
- WriteTxt (resPath + 'ASRInfo.txt', WavInputOut)
复制代码 写txt
- file_exists(File_Name,FileExits)
- if(FileExits)
- delete_file(File_Name)
- open_file(File_Name,'append',FileHandle)
- else
- open_file(File_Name,'output',FileHandle)
- endif
- fwrite_string(FileHandle, outputstr + '\n')
- close_file (FileHandle)
- return ()
复制代码
得到结果如下:
- D:/2-LearningCode/902-ASR/AISHELL-1/data_aishell/wav/train/S0002/BAC009S0002W0122.wav,D:\2-LearningCode\902-ASR\AISHELL-1\data_aishell\wav\train\S0002\BAC009S0002W0122.txt
- D:/2-LearningCode/902-ASR/AISHELL-1/data_aishell/wav/train/S0002/BAC009S0002W0123.wav,D:\2-LearningCode\902-ASR\AISHELL-1\data_aishell\wav\train\S0002\BAC009S0002W0123.txt
- D:/2-LearningCode/902-ASR/AISHELL-1/data_aishell/wav/train/S0002/BAC009S0002W0124.wav,D:\2-LearningCode\902-ASR\AISHELL-1\data_aishell\wav\train\S0002\BAC009S0002W0124.txt
- D:/2-LearningCode/902-ASR/AISHELL-1/data_aishell/wav/train/S0002/BAC009S0002W0125.wav,D:\2-LearningCode\902-ASR\AISHELL-1\data_aishell\wav\train\S0002\BAC009S0002W0125.txt
- D:/2-LearningCode/902-ASR/AISHELL-1/data_aishell/wav/train/S0002/BAC009S0002W0126.wav,D:\2-LearningCode\902-ASR\AISHELL-1\data_aishell\wav\train\S0002\BAC009S0002W0126.txt
复制代码
|
|