univoice 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/dist/chunk-ED5YYFDV.js +826 -0
- package/dist/chunk-ED5YYFDV.js.map +1 -0
- package/dist/src/asr/index.d.ts +48 -6
- package/dist/src/asr/index.js +21 -5
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +20 -4
- package/package.json +4 -3
- package/dist/chunk-DYNQPH5U.js +0 -211
- package/dist/chunk-DYNQPH5U.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/univoice)
|
|
10
10
|
[](https://www.npmjs.com/package/univoice)
|
|
11
|
-
[](https://opensource.org/licenses/Apache-2.0)
|
|
12
12
|
[](https://codecov.io/gh/shenjingnan/univoice)
|
|
13
13
|
|
|
14
14
|
**统一的 TTS(文字转语音)和 ASR(语音识别)SDK**
|
|
@@ -189,13 +189,14 @@ const asr = createASR({
|
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
const audioBuffer = readFileSync('audio.mp3');
|
|
192
|
-
const result = await asr.recognize({
|
|
193
|
-
audio: audioBuffer,
|
|
194
|
-
});
|
|
195
192
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
console.log(
|
|
193
|
+
// 流式识别
|
|
194
|
+
for await (const chunk of asr.listen(audioBuffer)) {
|
|
195
|
+
console.log(`识别文本: ${chunk.text}`);
|
|
196
|
+
if (chunk.isFinal) {
|
|
197
|
+
console.log('识别完成');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
199
200
|
```
|
|
200
201
|
|
|
201
202
|
---
|
|
@@ -269,7 +270,7 @@ const asr = createASR({
|
|
|
269
270
|
|
|
270
271
|
| 方法 | 说明 | 返回类型 |
|
|
271
272
|
|------|------|----------|
|
|
272
|
-
| `asr.
|
|
273
|
+
| `asr.listen(audio)` | 流式语音识别 | `AsyncIterable<ASRStreamChunk>` |
|
|
273
274
|
|
|
274
275
|
#### 工具函数
|
|
275
276
|
|
|
@@ -462,7 +463,7 @@ src/
|
|
|
462
463
|
|
|
463
464
|
## 许可证
|
|
464
465
|
|
|
465
|
-
[
|
|
466
|
+
[Apache-2.0](LICENSE)
|
|
466
467
|
|
|
467
468
|
---
|
|
468
469
|
|