sherpa-onnx-node 1.0.22 → 1.0.24

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.
@@ -0,0 +1,32 @@
1
+ const addon = require('./addon.js');
2
+ const streaming_asr = require('./streaming-asr.js');
3
+
4
+ class KeywordSpotter {
5
+ constructor(config) {
6
+ this.handle = addon.createKeywordSpotter(config);
7
+ this.config = config
8
+ }
9
+
10
+ createStream() {
11
+ const handle = addon.createKeywordStream(this.handle);
12
+ return new streaming_asr.OnlineStream(handle);
13
+ }
14
+
15
+ isReady(stream) {
16
+ return addon.isKeywordStreamReady(this.handle, stream.handle);
17
+ }
18
+
19
+ decode(stream) {
20
+ addon.decodeKeywordStream(this.handle, stream.handle);
21
+ }
22
+
23
+ getResult(stream) {
24
+ const jsonStr = addon.getKeywordResultAsJson(this.handle, stream.handle);
25
+
26
+ return JSON.parse(jsonStr);
27
+ }
28
+ }
29
+
30
+ module.exports = {
31
+ KeywordSpotter,
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sherpa-onnx-node",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Speech-to-text and text-to-speech using Next-gen Kaldi without internet connection",
5
5
  "main": "sherpa-onnx.js",
6
6
  "scripts": {
@@ -45,10 +45,10 @@
45
45
  },
46
46
  "homepage": "https://github.com/csukuangfj/sherpa-onnx#readme",
47
47
  "optionalDependencies": {
48
- "sherpa-onnx-darwin-arm64": "^1.0.22",
49
- "sherpa-onnx-darwin-x64": "^1.0.22",
50
- "sherpa-onnx-linux-x64": "^1.0.22",
51
- "sherpa-onnx-linux-arm64": "^1.0.22",
52
- "sherpa-onnx-win-x64": "^1.0.22"
48
+ "sherpa-onnx-darwin-arm64": "^1.0.24",
49
+ "sherpa-onnx-darwin-x64": "^1.0.24",
50
+ "sherpa-onnx-linux-x64": "^1.0.24",
51
+ "sherpa-onnx-linux-arm64": "^1.0.24",
52
+ "sherpa-onnx-win-x64": "^1.0.24"
53
53
  }
54
54
  }
package/punctuation.js ADDED
@@ -0,0 +1,15 @@
1
+ const addon = require('./addon.js');
2
+
3
+ class Punctuation {
4
+ constructor(config) {
5
+ this.handle = addon.createOfflinePunctuation(config);
6
+ this.config = config;
7
+ }
8
+ addPunct(text) {
9
+ return addon.offlinePunctuationAddPunct(this.handle, text);
10
+ }
11
+ }
12
+
13
+ module.exports = {
14
+ Punctuation,
15
+ }
package/sherpa-onnx.js CHANGED
@@ -6,6 +6,8 @@ const vad = require('./vad.js');
6
6
  const slid = require('./spoken-language-identification.js');
7
7
  const sid = require('./speaker-identification.js');
8
8
  const at = require('./audio-tagg.js');
9
+ const punct = require('./punctuation.js');
10
+ const kws = require('./keyword-spotter.js');
9
11
 
10
12
  module.exports = {
11
13
  OnlineRecognizer: streaming_asr.OnlineRecognizer,
@@ -20,4 +22,6 @@ module.exports = {
20
22
  SpeakerEmbeddingExtractor: sid.SpeakerEmbeddingExtractor,
21
23
  SpeakerEmbeddingManager: sid.SpeakerEmbeddingManager,
22
24
  AudioTagging: at.AudioTagging,
25
+ Punctuation: punct.Punctuation,
26
+ KeywordSpotter: kws.KeywordSpotter,
23
27
  }