Refactor Java API (#806)

This commit is contained in:
Fangjun Kuang
2024-04-24 18:41:48 +08:00
committed by GitHub
parent c7691650d7
commit c3a2e8a67c
42 changed files with 1008 additions and 968 deletions

View File

@@ -253,7 +253,7 @@ int32_t main(int32_t argc, char *argv[]) {
sherpa_onnx::ReadWave(wave_filename, &actual_sample_rate, &is_ok);
if (!is_ok) {
SHERPA_ONNX_LOGE("Failed to read %s", wave_filename.c_str());
SHERPA_ONNX_LOGE("Failed to read '%s'", wave_filename.c_str());
return -1;
}

View File

@@ -96,7 +96,7 @@ static std::vector<std::vector<float>> ComputeEmbeddings(
sherpa_onnx::ReadWave(f, &sampling_rate, &is_ok);
if (!is_ok) {
fprintf(stderr, "Failed to read %s\n", f.c_str());
fprintf(stderr, "Failed to read '%s'\n", f.c_str());
exit(-1);
}

View File

@@ -78,7 +78,7 @@ for a list of pre-trained models to download.
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
if (!is_ok) {
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
return -1;
}

View File

@@ -93,7 +93,7 @@ static std::vector<std::vector<float>> ComputeEmbeddings(
sherpa_onnx::ReadWave(f, &sampling_rate, &is_ok);
if (!is_ok) {
fprintf(stderr, "Failed to read %s\n", f.c_str());
fprintf(stderr, "Failed to read '%s'\n", f.c_str());
exit(-1);
}

View File

@@ -58,7 +58,7 @@ for more models.
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
if (!is_ok) {
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
return -1;
}

View File

@@ -73,7 +73,7 @@ for a list of pre-trained models to download.
const std::vector<float> samples =
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
if (!is_ok) {
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
return -1;
}
float duration = samples.size() / static_cast<float>(sampling_rate);

View File

@@ -69,7 +69,7 @@ void AsrInference(const std::vector<std::vector<std::string>> &chunk_wav_paths,
const std::vector<float> samples =
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
if (!is_ok) {
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
continue;
}
duration += samples.size() / static_cast<float>(sampling_rate);
@@ -96,7 +96,7 @@ void AsrInference(const std::vector<std::vector<std::string>> &chunk_wav_paths,
const std::vector<float> samples =
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
if (!is_ok) {
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
continue;
}
duration += samples.size() / static_cast<float>(sampling_rate);

View File

@@ -124,7 +124,7 @@ for a list of pre-trained models to download.
const std::vector<float> samples =
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
if (!is_ok) {
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
return -1;
}
duration += samples.size() / static_cast<float>(sampling_rate);

View File

@@ -109,7 +109,7 @@ for a list of pre-trained models to download.
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
if (!is_ok) {
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
return -1;
}