Commit
·
930be90
1
Parent(s):
5b0cb62
update model
Browse files- app-asr.js +10 -0
app-asr.js
CHANGED
|
@@ -108,8 +108,18 @@ if (navigator.mediaDevices.getUserMedia) {
|
|
| 108 |
}
|
| 109 |
|
| 110 |
let isEndpoint = recognizer.isEndpoint(recognizer_stream);
|
|
|
|
| 111 |
let result = recognizer.getResult(recognizer_stream).text;
|
| 112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
if (result.length > 0 && lastResult != result) {
|
| 115 |
lastResult = result;
|
|
|
|
| 108 |
}
|
| 109 |
|
| 110 |
let isEndpoint = recognizer.isEndpoint(recognizer_stream);
|
| 111 |
+
|
| 112 |
let result = recognizer.getResult(recognizer_stream).text;
|
| 113 |
|
| 114 |
+
if (recognizer.config.modelConfig.paraformer.encoder != '') {
|
| 115 |
+
let tailPaddings = new Float32Array(expectedSampleRate);
|
| 116 |
+
recognizer_stream.acceptWaveform(expectedSampleRate, tailPaddings);
|
| 117 |
+
while (recognizer.isReady(recognizer_stream)) {
|
| 118 |
+
recognizer.decode(recognizer_stream);
|
| 119 |
+
}
|
| 120 |
+
result = recognizer.getResult(recognizer_stream).text;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
|
| 124 |
if (result.length > 0 && lastResult != result) {
|
| 125 |
lastResult = result;
|