Support passing utf-8 strings from JavaScript to C++. (#1355)
We first convert utf-16 strings to Uint8Array and then we pass the array to C++.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"sherpa-onnx-node": "^1.10.26"
|
||||
"sherpa-onnx-node": "^1.10.27"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,19 @@ const sherpa_onnx = require('sherpa-onnx-node');
|
||||
|
||||
// Please download test files from
|
||||
// https://github.com/k2-fsa/sherpa-onnx/releases/tag/asr-models
|
||||
|
||||
|
||||
// If your path contains non-ascii characters, e.g., Chinese, you can use
|
||||
// the following code
|
||||
//
|
||||
|
||||
// let encoder = new TextEncoder();
|
||||
// let tokens = encoder.encode(
|
||||
// './sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17/测试.txt');
|
||||
// let model = encoder.encode(
|
||||
// './sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17/测试.int8.onnx');
|
||||
|
||||
|
||||
const config = {
|
||||
'featConfig': {
|
||||
'sampleRate': 16000,
|
||||
@@ -12,9 +25,11 @@ const config = {
|
||||
'senseVoice': {
|
||||
'model':
|
||||
'./sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17/model.int8.onnx',
|
||||
// 'model': model,
|
||||
'useInverseTextNormalization': 1,
|
||||
},
|
||||
'tokens': './sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17/tokens.txt',
|
||||
// 'tokens': tokens,
|
||||
'numThreads': 2,
|
||||
'provider': 'cpu',
|
||||
'debug': 1,
|
||||
|
||||
Reference in New Issue
Block a user