MOCKINGBIRD進行訓練時,測試在aishell3語音檔結構下僅取用單一人語音進行訓練,須將訓練文檔進行修改
aishell3語音檔案結構:
DATA_root>aishell3param(
[Parameter(Mandatory=$true, HelpMessage="The name of the input file.")]
[string]$FILENAME,
[Parameter(Mandatory=$true, HelpMessage="The string to match at the beginning of lines.")]
[string]$STRING
)
# 檢查參數是否為有效值
if (-not (Test-Path $FILENAME)) {
Write-Host "ERROR: The specified file '$FILENAME' does not exist."
exit
}
try {
$lines = Get-Content -Path $FILENAME -Encoding UTF8 | Where-Object {
# 排除空白行、以 '#' 開頭、以指定字串開頭的行
($_ -notmatch '^\s*$') -and ($_ -notmatch '^#') -and ($_ -like "$STRING*")
}
if ($lines.Count -eq 0) {
Write-Host "No lines matching the specified criteria were found in '$FILENAME'."
} else {
$FILENAME2 = $FILENAME.Replace(".", "_2.")
$lines | Out-File -FilePath $FILENAME2 -Encoding UTF8
Write-Host "Matching lines have been saved to '$FILENAME2'."
}
}
catch {
Write-Host "An error occurred while processing the file: $_"
exit
}
請先 登入 以發表留言。