mirror of
https://github.com/k2-fsa/sherpa-onnx.git
synced 2026-11-13 22:41:03 +08:00
Fix keyword spotting. (#1689)
Reset the stream right after detecting a keyword
This commit is contained in:
1 parent
b943341fb1
commit
8b989a851c
43 files changed
+813
-293
No files matched your search
@@ -56,6 +56,8 @@ public class KyewordSpotterFromFile {
|
||||
|
||||
String keyword = kws.getResult(stream).getKeyword();
|
||||
if (!keyword.isEmpty()) {
|
||||
// Remember to reset the stream right after detecting a keyword
|
||||
kws.reset(stream);
|
||||
System.out.printf("Detected keyword: %s\n", keyword);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user