Add KWS examples for Java API (#930)

This commit is contained in:
Fangjun Kuang
2024-05-28 15:49:54 +08:00
committed by GitHub
parent bcaa6df389
commit 5860e45b4c
11 changed files with 295 additions and 2 deletions

View File

@@ -91,6 +91,7 @@ public class VadNonStreamingParaformer {
stream.acceptWaveform(segment.getSamples(), 16000);
recognizer.decode(stream);
String text = recognizer.getResult(stream).getText();
stream.release();
if (!text.isEmpty()) {
System.out.printf("%.3f--%.3f: %s\n", startTime, startTime + duration, text);
@@ -100,5 +101,8 @@ public class VadNonStreamingParaformer {
}
}
}
vad.release();
recognizer.release();
}
}