react-native-sherpa-onnx 0.2.0 → 0.3.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 +232 -236
- package/SherpaOnnx.podspec +68 -64
- package/android/build.gradle +182 -192
- package/android/codegen.gradle +57 -0
- package/android/prebuilt-download.gradle +428 -0
- package/android/prebuilt-versions.gradle +43 -0
- package/android/proguard-rules.pro +10 -0
- package/android/src/main/assets/testModels/add_mul_add.onnx +28 -0
- package/android/src/main/assets/testModels/nnapi_internal_uint8_support.onnx +0 -0
- package/android/src/main/assets/testModels/qnn_multi_ctx_embed.onnx +0 -0
- package/android/src/main/cpp/CMakeLists.txt +166 -129
- package/android/src/main/cpp/CMakePresets.json +54 -0
- package/android/src/main/cpp/crypto/sha256.cpp +174 -0
- package/android/src/main/cpp/crypto/sha256.h +16 -0
- package/android/src/main/cpp/jni/archive/sherpa-onnx-archive-helper.cpp +404 -0
- package/android/src/main/cpp/jni/archive/sherpa-onnx-archive-helper.h +56 -0
- package/android/src/main/cpp/jni/archive/sherpa-onnx-archive-jni.cpp +181 -0
- package/android/src/main/cpp/jni/audio/sherpa-onnx-audio-convert-jni.cpp +888 -0
- package/{ios → android/src/main/cpp/jni/model_detect}/sherpa-onnx-common.h +18 -18
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-detect-jni-common.cpp +86 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-detect-jni-common.h +20 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-model-detect-helper.cpp +423 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-model-detect-helper.h +55 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-model-detect-stt.cpp +399 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-model-detect-tts.cpp +238 -0
- package/{ios → android/src/main/cpp/jni/model_detect}/sherpa-onnx-model-detect.h +122 -89
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-stt-wrapper.cpp +99 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-stt-wrapper.h +16 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-tts-wrapper.cpp +78 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-tts-wrapper.h +16 -0
- package/android/src/main/cpp/jni/module/sherpa-onnx-module-jni.cpp +190 -0
- package/android/src/main/cpp/jni/tts/sherpa-onnx-tts-zipvoice-jni.cpp +301 -0
- package/android/src/main/java/com/sherpaonnx/SherpaOnnxArchiveHelper.kt +94 -0
- package/android/src/main/java/com/sherpaonnx/{SherpaOnnxCoreHelper.kt → SherpaOnnxAssetHelper.kt} +350 -236
- package/android/src/main/java/com/sherpaonnx/SherpaOnnxModule.kt +791 -483
- package/android/src/main/java/com/sherpaonnx/SherpaOnnxSttHelper.kt +699 -109
- package/android/src/main/java/com/sherpaonnx/SherpaOnnxTtsHelper.kt +1123 -668
- package/android/src/main/java/com/sherpaonnx/ZipvoiceTtsWrapper.kt +187 -0
- package/ios/SherpaOnnx+Assets.h +11 -0
- package/ios/SherpaOnnx+Assets.mm +325 -0
- package/ios/SherpaOnnx+STT.mm +455 -118
- package/ios/SherpaOnnx+TTS.mm +1101 -712
- package/ios/SherpaOnnx.h +17 -6
- package/ios/SherpaOnnx.mm +206 -311
- package/ios/SherpaOnnx.xcconfig +19 -19
- package/ios/SherpaOnnxCoreMLHelper.swift +24 -0
- package/ios/archive/sherpa-onnx-archive-helper.h +21 -0
- package/ios/archive/sherpa-onnx-archive-helper.mm +296 -0
- package/ios/libarchive_darwin_config.h +153 -0
- package/{android/src/main/cpp/jni → ios/model_detect}/sherpa-onnx-common.h +18 -18
- package/ios/model_detect/sherpa-onnx-model-detect-helper.h +49 -0
- package/ios/model_detect/sherpa-onnx-model-detect-helper.mm +210 -0
- package/ios/model_detect/sherpa-onnx-model-detect-stt.mm +344 -0
- package/ios/model_detect/sherpa-onnx-model-detect-tts.mm +201 -0
- package/{android/src/main/cpp/jni → ios/model_detect}/sherpa-onnx-model-detect.h +117 -89
- package/ios/scripts/patch-libarchive-includes.sh +61 -0
- package/ios/scripts/setup-ios-libarchive.sh +98 -0
- package/ios/stt/sherpa-onnx-stt-wrapper.h +129 -0
- package/ios/stt/sherpa-onnx-stt-wrapper.mm +523 -0
- package/ios/{sherpa-onnx-tts-wrapper.h → tts/sherpa-onnx-tts-wrapper.h} +90 -85
- package/ios/{sherpa-onnx-tts-wrapper.mm → tts/sherpa-onnx-tts-wrapper.mm} +376 -345
- package/lib/module/NativeSherpaOnnx.js +3 -0
- package/lib/module/NativeSherpaOnnx.js.map +1 -1
- package/lib/module/audio/index.js +22 -0
- package/lib/module/audio/index.js.map +1 -0
- package/lib/module/diarization/index.js +1 -1
- package/lib/module/diarization/index.js.map +1 -1
- package/lib/module/download/ModelDownloadManager.js +918 -0
- package/lib/module/download/ModelDownloadManager.js.map +1 -0
- package/lib/module/download/extractTarBz2.js +53 -0
- package/lib/module/download/extractTarBz2.js.map +1 -0
- package/lib/module/download/index.js +6 -0
- package/lib/module/download/index.js.map +1 -0
- package/lib/module/download/validation.js +178 -0
- package/lib/module/download/validation.js.map +1 -0
- package/lib/module/enhancement/index.js +1 -1
- package/lib/module/enhancement/index.js.map +1 -1
- package/lib/module/index.js +41 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/separation/index.js +1 -1
- package/lib/module/separation/index.js.map +1 -1
- package/lib/module/stt/index.js +127 -60
- package/lib/module/stt/index.js.map +1 -1
- package/lib/module/stt/sttModelLanguages.js +512 -0
- package/lib/module/stt/sttModelLanguages.js.map +1 -0
- package/lib/module/stt/types.js +53 -1
- package/lib/module/stt/types.js.map +1 -1
- package/lib/module/tts/index.js +216 -289
- package/lib/module/tts/index.js.map +1 -1
- package/lib/module/tts/types.js +86 -1
- package/lib/module/tts/types.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils.js +86 -73
- package/lib/module/utils.js.map +1 -1
- package/lib/module/vad/index.js +1 -1
- package/lib/module/vad/index.js.map +1 -1
- package/lib/typescript/src/NativeSherpaOnnx.d.ts +192 -38
- package/lib/typescript/src/NativeSherpaOnnx.d.ts.map +1 -1
- package/lib/typescript/src/audio/index.d.ts +13 -0
- package/lib/typescript/src/audio/index.d.ts.map +1 -0
- package/lib/typescript/src/diarization/index.d.ts +3 -2
- package/lib/typescript/src/diarization/index.d.ts.map +1 -1
- package/lib/typescript/src/download/ModelDownloadManager.d.ts +108 -0
- package/lib/typescript/src/download/ModelDownloadManager.d.ts.map +1 -0
- package/lib/typescript/src/download/extractTarBz2.d.ts +14 -0
- package/lib/typescript/src/download/extractTarBz2.d.ts.map +1 -0
- package/lib/typescript/src/download/index.d.ts +7 -0
- package/lib/typescript/src/download/index.d.ts.map +1 -0
- package/lib/typescript/src/download/validation.d.ts +57 -0
- package/lib/typescript/src/download/validation.d.ts.map +1 -0
- package/lib/typescript/src/enhancement/index.d.ts +3 -2
- package/lib/typescript/src/enhancement/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +26 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/separation/index.d.ts +3 -2
- package/lib/typescript/src/separation/index.d.ts.map +1 -1
- package/lib/typescript/src/stt/index.d.ts +31 -43
- package/lib/typescript/src/stt/index.d.ts.map +1 -1
- package/lib/typescript/src/stt/sttModelLanguages.d.ts +52 -0
- package/lib/typescript/src/stt/sttModelLanguages.d.ts.map +1 -0
- package/lib/typescript/src/stt/types.d.ts +196 -9
- package/lib/typescript/src/stt/types.d.ts.map +1 -1
- package/lib/typescript/src/tts/index.d.ts +25 -211
- package/lib/typescript/src/tts/index.d.ts.map +1 -1
- package/lib/typescript/src/tts/types.d.ts +148 -25
- package/lib/typescript/src/tts/types.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +0 -32
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils.d.ts +28 -13
- package/lib/typescript/src/utils.d.ts.map +1 -1
- package/lib/typescript/src/vad/index.d.ts +3 -2
- package/lib/typescript/src/vad/index.d.ts.map +1 -1
- package/package.json +250 -222
- package/scripts/check-qnn-support.sh +78 -0
- package/scripts/setup-ios-framework.sh +379 -282
- package/src/NativeSherpaOnnx.ts +474 -251
- package/src/audio/index.ts +32 -0
- package/src/diarization/index.ts +4 -2
- package/src/download/ModelDownloadManager.ts +1325 -0
- package/src/download/extractTarBz2.ts +78 -0
- package/src/download/index.ts +43 -0
- package/src/download/validation.ts +279 -0
- package/src/enhancement/index.ts +4 -2
- package/src/index.tsx +78 -27
- package/src/separation/index.ts +4 -2
- package/src/stt/index.ts +249 -89
- package/src/stt/sttModelLanguages.ts +237 -0
- package/src/stt/types.ts +263 -9
- package/src/tts/index.ts +470 -458
- package/src/tts/types.ts +373 -218
- package/src/types.ts +0 -44
- package/src/utils.ts +145 -131
- package/src/vad/index.ts +4 -2
- package/third_party/ffmpeg_prebuilt/ANDROID_RELEASE_TAG +1 -0
- package/third_party/libarchive_prebuilt/ANDROID_RELEASE_TAG +1 -0
- package/third_party/libarchive_prebuilt/IOS_RELEASE_TAG +1 -0
- package/third_party/sherpa-onnx-prebuilt/ANDROID_RELEASE_TAG +1 -0
- package/third_party/sherpa-onnx-prebuilt/IOS_RELEASE_TAG +1 -0
- package/android/src/main/cpp/include/sherpa-onnx/c-api/c-api.h +0 -1918
- package/android/src/main/cpp/include/sherpa-onnx/c-api/cxx-api.h +0 -841
- package/android/src/main/cpp/jni/sherpa-onnx-model-detect.cpp +0 -541
- package/android/src/main/cpp/jni/sherpa-onnx-stt-jni.cpp +0 -336
- package/android/src/main/cpp/jni/sherpa-onnx-stt-wrapper.cpp +0 -222
- package/android/src/main/cpp/jni/sherpa-onnx-stt-wrapper.h +0 -68
- package/android/src/main/cpp/jni/sherpa-onnx-tts-jni.cpp +0 -823
- package/android/src/main/cpp/jni/sherpa-onnx-tts-wrapper.cpp +0 -387
- package/android/src/main/cpp/jni/sherpa-onnx-tts-wrapper.h +0 -147
- package/ios/Frameworks/sherpa_onnx.xcframework.zip +0 -0
- package/ios/include/sherpa-onnx/c-api/c-api.h +0 -1918
- package/ios/include/sherpa-onnx/c-api/cxx-api.h +0 -841
- package/ios/sherpa-onnx-model-detect.mm +0 -441
- package/ios/sherpa-onnx-stt-wrapper.h +0 -48
- package/ios/sherpa-onnx-stt-wrapper.mm +0 -201
- package/scripts/copy-headers.js +0 -184
- package/scripts/setup-assets.js +0 -323
package/lib/module/stt/index.js
CHANGED
|
@@ -2,81 +2,148 @@
|
|
|
2
2
|
|
|
3
3
|
import SherpaOnnx from "../NativeSherpaOnnx.js";
|
|
4
4
|
import { resolveModelPath } from "../utils.js";
|
|
5
|
+
let sttInstanceCounter = 0;
|
|
6
|
+
function normalizeSttResult(raw) {
|
|
7
|
+
return {
|
|
8
|
+
text: typeof raw.text === 'string' ? raw.text : '',
|
|
9
|
+
tokens: Array.isArray(raw.tokens) ? raw.tokens : [],
|
|
10
|
+
timestamps: Array.isArray(raw.timestamps) ? raw.timestamps : [],
|
|
11
|
+
lang: typeof raw.lang === 'string' ? raw.lang : '',
|
|
12
|
+
emotion: typeof raw.emotion === 'string' ? raw.emotion : '',
|
|
13
|
+
event: typeof raw.event === 'string' ? raw.event : '',
|
|
14
|
+
durations: Array.isArray(raw.durations) ? raw.durations : []
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Detect STT model type and structure without initializing the recognizer.
|
|
20
|
+
* Uses the same native file-based detection as createSTT. Stateless; no instance required.
|
|
21
|
+
*
|
|
22
|
+
* @param modelPath - Model path configuration (asset, file, or auto)
|
|
23
|
+
* @param options - Optional preferInt8 and modelType (default: auto)
|
|
24
|
+
* @returns Object with success, detectedModels (array of { type, modelDir }), and modelType (primary detected type)
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const path = { type: 'asset' as const, path: 'models/sherpa-onnx-whisper-tiny-en' };
|
|
28
|
+
* const result = await detectSttModel(path);
|
|
29
|
+
* if (result.success && result.detectedModels.length > 0) {
|
|
30
|
+
* console.log('Detected type:', result.modelType, result.detectedModels);
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export async function detectSttModel(modelPath, options) {
|
|
35
|
+
const resolvedPath = await resolveModelPath(modelPath);
|
|
36
|
+
return SherpaOnnx.detectSttModel(resolvedPath, options?.preferInt8, options?.modelType);
|
|
37
|
+
}
|
|
5
38
|
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* console.log('Detected models:', result.detectedModels);
|
|
21
|
-
* // result.detectedModels = [{ type: 'transducer', modelDir: '/path/to/model' }]
|
|
22
|
-
*
|
|
23
|
-
* // Asset model
|
|
24
|
-
* const result = await initializeSTT({
|
|
25
|
-
* modelPath: { type: 'asset', path: 'models/sherpa-onnx-model' }
|
|
26
|
-
* });
|
|
27
|
-
*
|
|
28
|
-
* // File system model with preferInt8 option
|
|
29
|
-
* const result = await initializeSTT({
|
|
30
|
-
* modelPath: { type: 'file', path: '/path/to/model' },
|
|
31
|
-
* preferInt8: true // Prefer quantized int8 models (smaller, faster)
|
|
32
|
-
* });
|
|
33
|
-
*
|
|
34
|
-
* // With explicit model type
|
|
35
|
-
* const result = await initializeSTT({
|
|
36
|
-
* modelPath: { type: 'asset', path: 'models/sherpa-onnx-nemo-parakeet-tdt-ctc-en' },
|
|
37
|
-
* modelType: 'nemo_ctc'
|
|
38
|
-
* });
|
|
39
|
-
* ```
|
|
39
|
+
/**
|
|
40
|
+
* Create an STT engine instance. Call destroy() on the returned engine when done to free native resources.
|
|
41
|
+
*
|
|
42
|
+
* @param options - STT initialization options or model path configuration
|
|
43
|
+
* @returns Promise resolving to an SttEngine instance
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const stt = await createSTT({
|
|
47
|
+
* modelPath: { type: 'asset', path: 'models/whisper-tiny' },
|
|
48
|
+
* });
|
|
49
|
+
* const result = await stt.transcribeFile('/path/to/audio.wav');
|
|
50
|
+
* console.log(result.text);
|
|
51
|
+
* await stt.destroy();
|
|
52
|
+
* ```
|
|
40
53
|
*/
|
|
41
|
-
export async function
|
|
42
|
-
|
|
54
|
+
export async function createSTT(options) {
|
|
55
|
+
const instanceId = `stt_${++sttInstanceCounter}`;
|
|
43
56
|
let modelPath;
|
|
44
57
|
let preferInt8;
|
|
45
58
|
let modelType;
|
|
46
|
-
|
|
59
|
+
let hotwordsFile;
|
|
60
|
+
let hotwordsScore;
|
|
61
|
+
let numThreads;
|
|
62
|
+
let provider;
|
|
63
|
+
let ruleFsts;
|
|
64
|
+
let ruleFars;
|
|
65
|
+
let dither;
|
|
66
|
+
let modelOptions;
|
|
67
|
+
let modelingUnit;
|
|
68
|
+
let bpeVocab;
|
|
69
|
+
if ('modelPath' in options) {
|
|
47
70
|
modelPath = options.modelPath;
|
|
48
71
|
preferInt8 = options.preferInt8;
|
|
49
72
|
modelType = options.modelType;
|
|
73
|
+
hotwordsFile = options.hotwordsFile;
|
|
74
|
+
hotwordsScore = options.hotwordsScore;
|
|
75
|
+
numThreads = options.numThreads;
|
|
76
|
+
provider = options.provider;
|
|
77
|
+
ruleFsts = options.ruleFsts;
|
|
78
|
+
ruleFars = options.ruleFars;
|
|
79
|
+
dither = options.dither;
|
|
80
|
+
modelOptions = options.modelOptions;
|
|
81
|
+
modelingUnit = options.modelingUnit;
|
|
82
|
+
bpeVocab = options.bpeVocab;
|
|
50
83
|
} else {
|
|
51
84
|
modelPath = options;
|
|
52
85
|
preferInt8 = undefined;
|
|
53
86
|
modelType = undefined;
|
|
87
|
+
hotwordsFile = undefined;
|
|
88
|
+
hotwordsScore = undefined;
|
|
89
|
+
numThreads = undefined;
|
|
90
|
+
provider = undefined;
|
|
91
|
+
ruleFsts = undefined;
|
|
92
|
+
ruleFars = undefined;
|
|
93
|
+
dither = undefined;
|
|
94
|
+
modelOptions = undefined;
|
|
95
|
+
modelingUnit = undefined;
|
|
96
|
+
bpeVocab = undefined;
|
|
54
97
|
}
|
|
98
|
+
const debug = 'modelPath' in options ? options.debug : undefined;
|
|
55
99
|
const resolvedPath = await resolveModelPath(modelPath);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
100
|
+
const result = await SherpaOnnx.initializeStt(instanceId, resolvedPath, preferInt8, modelType, debug, hotwordsFile, hotwordsScore, numThreads, provider, ruleFsts, ruleFars, dither, modelOptions, modelingUnit, bpeVocab);
|
|
101
|
+
if (!result.success) {
|
|
102
|
+
throw new Error(`STT initialization failed: ${JSON.stringify(result.detectedModels ?? [])}`);
|
|
103
|
+
}
|
|
104
|
+
let destroyed = false;
|
|
105
|
+
const guard = () => {
|
|
106
|
+
if (destroyed) {
|
|
107
|
+
throw new Error(`STT instance ${instanceId} has been destroyed; cannot call methods on it.`);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const engine = {
|
|
111
|
+
get instanceId() {
|
|
112
|
+
return instanceId;
|
|
113
|
+
},
|
|
114
|
+
async transcribeFile(filePath) {
|
|
115
|
+
guard();
|
|
116
|
+
const raw = await SherpaOnnx.transcribeFile(instanceId, filePath);
|
|
117
|
+
return normalizeSttResult(raw);
|
|
118
|
+
},
|
|
119
|
+
async transcribeSamples(samples, sampleRate) {
|
|
120
|
+
guard();
|
|
121
|
+
const raw = await SherpaOnnx.transcribeSamples(instanceId, samples, sampleRate);
|
|
122
|
+
return normalizeSttResult(raw);
|
|
123
|
+
},
|
|
124
|
+
async setConfig(config) {
|
|
125
|
+
guard();
|
|
126
|
+
const map = {};
|
|
127
|
+
if (config.decodingMethod != null) map.decodingMethod = config.decodingMethod;
|
|
128
|
+
if (config.maxActivePaths != null) map.maxActivePaths = config.maxActivePaths;
|
|
129
|
+
if (config.hotwordsFile != null) map.hotwordsFile = config.hotwordsFile;
|
|
130
|
+
if (config.hotwordsScore != null) map.hotwordsScore = config.hotwordsScore;
|
|
131
|
+
if (config.blankPenalty != null) map.blankPenalty = config.blankPenalty;
|
|
132
|
+
if (config.ruleFsts != null) map.ruleFsts = config.ruleFsts;
|
|
133
|
+
if (config.ruleFars != null) map.ruleFars = config.ruleFars;
|
|
134
|
+
return SherpaOnnx.setSttConfig(instanceId, map);
|
|
135
|
+
},
|
|
136
|
+
async destroy() {
|
|
137
|
+
if (destroyed) return;
|
|
138
|
+
destroyed = true;
|
|
139
|
+
await SherpaOnnx.unloadStt(instanceId);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
return engine;
|
|
72
143
|
}
|
|
73
144
|
|
|
74
|
-
|
|
75
|
-
* Release STT resources.
|
|
76
|
-
*/
|
|
77
|
-
export function unloadSTT() {
|
|
78
|
-
return SherpaOnnx.unloadSherpaOnnx();
|
|
79
|
-
}
|
|
145
|
+
// Export types and runtime type list
|
|
80
146
|
|
|
81
|
-
|
|
147
|
+
export { STT_MODEL_TYPES, STT_HOTWORDS_MODEL_TYPES, sttSupportsHotwords } from "./types.js";
|
|
148
|
+
export { getWhisperLanguages, WHISPER_LANGUAGES, getSenseVoiceLanguages, SENSEVOICE_LANGUAGES, getCanaryLanguages, CANARY_LANGUAGES, getFunasrNanoLanguages, FUNASR_NANO_LANGUAGES, getFunasrMltNanoLanguages, FUNASR_MLT_NANO_LANGUAGES } from "./sttModelLanguages.js";
|
|
82
149
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SherpaOnnx","resolveModelPath","
|
|
1
|
+
{"version":3,"names":["SherpaOnnx","resolveModelPath","sttInstanceCounter","normalizeSttResult","raw","text","tokens","Array","isArray","timestamps","lang","emotion","event","durations","detectSttModel","modelPath","options","resolvedPath","preferInt8","modelType","createSTT","instanceId","hotwordsFile","hotwordsScore","numThreads","provider","ruleFsts","ruleFars","dither","modelOptions","modelingUnit","bpeVocab","undefined","debug","result","initializeStt","success","Error","JSON","stringify","detectedModels","destroyed","guard","engine","transcribeFile","filePath","transcribeSamples","samples","sampleRate","setConfig","config","map","decodingMethod","maxActivePaths","blankPenalty","setSttConfig","destroy","unloadStt","STT_MODEL_TYPES","STT_HOTWORDS_MODEL_TYPES","sttSupportsHotwords","getWhisperLanguages","WHISPER_LANGUAGES","getSenseVoiceLanguages","SENSEVOICE_LANGUAGES","getCanaryLanguages","CANARY_LANGUAGES","getFunasrNanoLanguages","FUNASR_NANO_LANGUAGES","getFunasrMltNanoLanguages","FUNASR_MLT_NANO_LANGUAGES"],"sourceRoot":"../../../src","sources":["stt/index.ts"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,wBAAqB;AAU5C,SAASC,gBAAgB,QAAQ,aAAU;AAE3C,IAAIC,kBAAkB,GAAG,CAAC;AAE1B,SAASC,kBAAkBA,CAACC,GAQ3B,EAAwB;EACvB,OAAO;IACLC,IAAI,EAAE,OAAOD,GAAG,CAACC,IAAI,KAAK,QAAQ,GAAGD,GAAG,CAACC,IAAI,GAAG,EAAE;IAClDC,MAAM,EAAEC,KAAK,CAACC,OAAO,CAACJ,GAAG,CAACE,MAAM,CAAC,GAAIF,GAAG,CAACE,MAAM,GAAgB,EAAE;IACjEG,UAAU,EAAEF,KAAK,CAACC,OAAO,CAACJ,GAAG,CAACK,UAAU,CAAC,GACpCL,GAAG,CAACK,UAAU,GACf,EAAE;IACNC,IAAI,EAAE,OAAON,GAAG,CAACM,IAAI,KAAK,QAAQ,GAAGN,GAAG,CAACM,IAAI,GAAG,EAAE;IAClDC,OAAO,EAAE,OAAOP,GAAG,CAACO,OAAO,KAAK,QAAQ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