Committed by
GitHub
Add blank penalty for various language bindings. (#1234)
正在显示
38 个修改的文件
包含
123 行增加
和
42 行删除
| 1 | +## 1.10.21 | ||
| 2 | + | ||
| 3 | +* Fix ffmpeg c api example (#1185) | ||
| 4 | +* Fix splitting sentences for MeloTTS (#1186) | ||
| 5 | +* Non-streaming WebSocket client for Java. (#1190) | ||
| 6 | +* Fix copying asset files for flutter examples. (#1191) | ||
| 7 | +* Add Chinese+English tts example for flutter (#1192) | ||
| 8 | +* Add speaker identification and verification exmaple for Dart API (#1194) | ||
| 9 | +* Fix reading non-standard wav files. (#1199) | ||
| 10 | +* Add ReazonSpeech Japanese pre-trained model (#1203) | ||
| 11 | +* Describe how to add new words for MeloTTS models (#1209) | ||
| 12 | +* Remove libonnxruntime_providers_cuda.so as a dependency. (#1210) | ||
| 13 | +* Fix setting SenseVoice language. (#1214) | ||
| 14 | +* Support passing TTS callback in Swift API (#1218) | ||
| 15 | +* Add MeloTTS example for ios (#1223) | ||
| 16 | +* Add online punctuation and casing prediction model for English language (#1224) | ||
| 17 | +* Fix python two pass ASR examples (#1230) | ||
| 18 | +* Add blank penalty for various language bindings | ||
| 19 | + | ||
| 1 | ## 1.10.20 | 20 | ## 1.10.20 |
| 2 | 21 | ||
| 3 | * Add Dart API for audio tagging | 22 | * Add Dart API for audio tagging |
| @@ -11,7 +11,7 @@ project(sherpa-onnx) | @@ -11,7 +11,7 @@ project(sherpa-onnx) | ||
| 11 | # ./nodejs-addon-examples | 11 | # ./nodejs-addon-examples |
| 12 | # ./dart-api-examples/ | 12 | # ./dart-api-examples/ |
| 13 | # ./CHANGELOG.md | 13 | # ./CHANGELOG.md |
| 14 | -set(SHERPA_ONNX_VERSION "1.10.20") | 14 | +set(SHERPA_ONNX_VERSION "1.10.21") |
| 15 | 15 | ||
| 16 | # Disable warning about | 16 | # Disable warning about |
| 17 | # | 17 | # |
| @@ -126,7 +126,7 @@ echo "Generate xcframework" | @@ -126,7 +126,7 @@ echo "Generate xcframework" | ||
| 126 | 126 | ||
| 127 | mkdir -p "build/simulator/lib" | 127 | mkdir -p "build/simulator/lib" |
| 128 | for f in libkaldi-native-fbank-core.a libsherpa-onnx-c-api.a libsherpa-onnx-core.a \ | 128 | for f in libkaldi-native-fbank-core.a libsherpa-onnx-c-api.a libsherpa-onnx-core.a \ |
| 129 | - libsherpa-onnx-fst.a libsherpa-onnx-kaldifst-core.a libkaldi-decoder-core.a libssentencepiece_core.a; do | 129 | + libsherpa-onnx-fst.a libsherpa-onnx-fstfar.a libsherpa-onnx-kaldifst-core.a libkaldi-decoder-core.a libssentencepiece_core.a; do |
| 130 | lipo -create build/simulator_arm64/lib/${f} \ | 130 | lipo -create build/simulator_arm64/lib/${f} \ |
| 131 | build/simulator_x86_64/lib/${f} \ | 131 | build/simulator_x86_64/lib/${f} \ |
| 132 | -output build/simulator/lib/${f} | 132 | -output build/simulator/lib/${f} |
| @@ -139,6 +139,7 @@ libtool -static -o build/simulator/sherpa-onnx.a \ | @@ -139,6 +139,7 @@ libtool -static -o build/simulator/sherpa-onnx.a \ | ||
| 139 | build/simulator/lib/libsherpa-onnx-c-api.a \ | 139 | build/simulator/lib/libsherpa-onnx-c-api.a \ |
| 140 | build/simulator/lib/libsherpa-onnx-core.a \ | 140 | build/simulator/lib/libsherpa-onnx-core.a \ |
| 141 | build/simulator/lib/libsherpa-onnx-fst.a \ | 141 | build/simulator/lib/libsherpa-onnx-fst.a \ |
| 142 | + build/simulator/lib/libsherpa-onnx-fstfar.a \ | ||
| 142 | build/simulator/lib/libsherpa-onnx-kaldifst-core.a \ | 143 | build/simulator/lib/libsherpa-onnx-kaldifst-core.a \ |
| 143 | build/simulator/lib/libkaldi-decoder-core.a \ | 144 | build/simulator/lib/libkaldi-decoder-core.a \ |
| 144 | build/simulator/lib/libssentencepiece_core.a | 145 | build/simulator/lib/libssentencepiece_core.a |
| @@ -148,6 +149,7 @@ libtool -static -o build/os64/sherpa-onnx.a \ | @@ -148,6 +149,7 @@ libtool -static -o build/os64/sherpa-onnx.a \ | ||
| 148 | build/os64/lib/libsherpa-onnx-c-api.a \ | 149 | build/os64/lib/libsherpa-onnx-c-api.a \ |
| 149 | build/os64/lib/libsherpa-onnx-core.a \ | 150 | build/os64/lib/libsherpa-onnx-core.a \ |
| 150 | build/os64/lib/libsherpa-onnx-fst.a \ | 151 | build/os64/lib/libsherpa-onnx-fst.a \ |
| 152 | + build/os64/lib/libsherpa-onnx-fstfar.a \ | ||
| 151 | build/os64/lib/libsherpa-onnx-kaldifst-core.a \ | 153 | build/os64/lib/libsherpa-onnx-kaldifst-core.a \ |
| 152 | build/os64/lib/libkaldi-decoder-core.a \ | 154 | build/os64/lib/libkaldi-decoder-core.a \ |
| 153 | build/os64/lib/libssentencepiece_core.a | 155 | build/os64/lib/libssentencepiece_core.a |
| @@ -9,7 +9,7 @@ environment: | @@ -9,7 +9,7 @@ environment: | ||
| 9 | sdk: ^3.4.0 | 9 | sdk: ^3.4.0 |
| 10 | 10 | ||
| 11 | dependencies: | 11 | dependencies: |
| 12 | - sherpa_onnx: ^1.10.20 | 12 | + sherpa_onnx: ^1.10.21 |
| 13 | # sherpa_onnx: | 13 | # sherpa_onnx: |
| 14 | # path: ../../flutter/sherpa_onnx | 14 | # path: ../../flutter/sherpa_onnx |
| 15 | path: ^1.9.0 | 15 | path: ^1.9.0 |
| @@ -5,7 +5,7 @@ description: > | @@ -5,7 +5,7 @@ description: > | ||
| 5 | 5 | ||
| 6 | publish_to: 'none' | 6 | publish_to: 'none' |
| 7 | 7 | ||
| 8 | -version: 1.10.20 | 8 | +version: 1.10.21 |
| 9 | 9 | ||
| 10 | topics: | 10 | topics: |
| 11 | - speech-recognition | 11 | - speech-recognition |
| @@ -30,7 +30,7 @@ dependencies: | @@ -30,7 +30,7 @@ dependencies: | ||
| 30 | record: ^5.1.0 | 30 | record: ^5.1.0 |
| 31 | url_launcher: ^6.2.6 | 31 | url_launcher: ^6.2.6 |
| 32 | 32 | ||
| 33 | - sherpa_onnx: ^1.10.20 | 33 | + sherpa_onnx: ^1.10.21 |
| 34 | # sherpa_onnx: | 34 | # sherpa_onnx: |
| 35 | # path: ../../flutter/sherpa_onnx | 35 | # path: ../../flutter/sherpa_onnx |
| 36 | 36 |
| @@ -5,7 +5,7 @@ description: > | @@ -5,7 +5,7 @@ description: > | ||
| 5 | 5 | ||
| 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev | 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev |
| 7 | 7 | ||
| 8 | -version: 1.10.20 | 8 | +version: 1.10.21 |
| 9 | 9 | ||
| 10 | environment: | 10 | environment: |
| 11 | sdk: '>=3.4.0 <4.0.0' | 11 | sdk: '>=3.4.0 <4.0.0' |
| @@ -17,7 +17,7 @@ dependencies: | @@ -17,7 +17,7 @@ dependencies: | ||
| 17 | cupertino_icons: ^1.0.6 | 17 | cupertino_icons: ^1.0.6 |
| 18 | path_provider: ^2.1.3 | 18 | path_provider: ^2.1.3 |
| 19 | path: ^1.9.0 | 19 | path: ^1.9.0 |
| 20 | - sherpa_onnx: ^1.10.20 | 20 | + sherpa_onnx: ^1.10.21 |
| 21 | url_launcher: ^6.2.6 | 21 | url_launcher: ^6.2.6 |
| 22 | audioplayers: ^5.0.0 | 22 | audioplayers: ^5.0.0 |
| 23 | 23 |
| @@ -159,11 +159,12 @@ class OfflineRecognizerConfig { | @@ -159,11 +159,12 @@ class OfflineRecognizerConfig { | ||
| 159 | this.hotwordsScore = 1.5, | 159 | this.hotwordsScore = 1.5, |
| 160 | this.ruleFsts = '', | 160 | this.ruleFsts = '', |
| 161 | this.ruleFars = '', | 161 | this.ruleFars = '', |
| 162 | + this.blankPenalty = 0.0, | ||
| 162 | }); | 163 | }); |
| 163 | 164 | ||
| 164 | @override | 165 | @override |
| 165 | String toString() { | 166 | String toString() { |
| 166 | - return 'OfflineRecognizerConfig(feat: $feat, model: $model, lm: $lm, decodingMethod: $decodingMethod, maxActivePaths: $maxActivePaths, hotwordsFile: $hotwordsFile, hotwordsScore: $hotwordsScore, ruleFsts: $ruleFsts, ruleFars: $ruleFars)'; | 167 | + return 'OfflineRecognizerConfig(feat: $feat, model: $model, lm: $lm, decodingMethod: $decodingMethod, maxActivePaths: $maxActivePaths, hotwordsFile: $hotwordsFile, hotwordsScore: $hotwordsScore, ruleFsts: $ruleFsts, ruleFars: $ruleFars, blankPenalty: $blankPenalty)'; |
| 167 | } | 168 | } |
| 168 | 169 | ||
| 169 | final FeatureConfig feat; | 170 | final FeatureConfig feat; |
| @@ -179,6 +180,8 @@ class OfflineRecognizerConfig { | @@ -179,6 +180,8 @@ class OfflineRecognizerConfig { | ||
| 179 | 180 | ||
| 180 | final String ruleFsts; | 181 | final String ruleFsts; |
| 181 | final String ruleFars; | 182 | final String ruleFars; |
| 183 | + | ||
| 184 | + final double blankPenalty; | ||
| 182 | } | 185 | } |
| 183 | 186 | ||
| 184 | class OfflineRecognizerResult { | 187 | class OfflineRecognizerResult { |
| @@ -268,6 +271,8 @@ class OfflineRecognizer { | @@ -268,6 +271,8 @@ class OfflineRecognizer { | ||
| 268 | c.ref.ruleFsts = config.ruleFsts.toNativeUtf8(); | 271 | c.ref.ruleFsts = config.ruleFsts.toNativeUtf8(); |
| 269 | c.ref.ruleFars = config.ruleFars.toNativeUtf8(); | 272 | c.ref.ruleFars = config.ruleFars.toNativeUtf8(); |
| 270 | 273 | ||
| 274 | + c.ref.blankPenalty = config.blankPenalty; | ||
| 275 | + | ||
| 271 | final ptr = SherpaOnnxBindings.createOfflineRecognizer?.call(c) ?? nullptr; | 276 | final ptr = SherpaOnnxBindings.createOfflineRecognizer?.call(c) ?? nullptr; |
| 272 | 277 | ||
| 273 | calloc.free(c.ref.ruleFars); | 278 | calloc.free(c.ref.ruleFars); |
| @@ -114,11 +114,12 @@ class OnlineRecognizerConfig { | @@ -114,11 +114,12 @@ class OnlineRecognizerConfig { | ||
| 114 | this.ctcFstDecoderConfig = const OnlineCtcFstDecoderConfig(), | 114 | this.ctcFstDecoderConfig = const OnlineCtcFstDecoderConfig(), |
| 115 | this.ruleFsts = '', | 115 | this.ruleFsts = '', |
| 116 | this.ruleFars = '', | 116 | this.ruleFars = '', |
| 117 | + this.blankPenalty = 0.0, | ||
| 117 | }); | 118 | }); |
| 118 | 119 | ||
| 119 | @override | 120 | @override |
| 120 | String toString() { | 121 | String toString() { |
| 121 | - return 'OnlineRecognizerConfig(feat: $feat, model: $model, decodingMethod: $decodingMethod, maxActivePaths: $maxActivePaths, enableEndpoint: $enableEndpoint, rule1MinTrailingSilence: $rule1MinTrailingSilence, rule2MinTrailingSilence: $rule2MinTrailingSilence, rule3MinUtteranceLength: $rule3MinUtteranceLength, hotwordsFile: $hotwordsFile, hotwordsScore: $hotwordsScore, ctcFstDecoderConfig: $ctcFstDecoderConfig, ruleFsts: $ruleFsts, ruleFars: $ruleFars)'; | 122 | + return 'OnlineRecognizerConfig(feat: $feat, model: $model, decodingMethod: $decodingMethod, maxActivePaths: $maxActivePaths, enableEndpoint: $enableEndpoint, rule1MinTrailingSilence: $rule1MinTrailingSilence, rule2MinTrailingSilence: $rule2MinTrailingSilence, rule3MinUtteranceLength: $rule3MinUtteranceLength, hotwordsFile: $hotwordsFile, hotwordsScore: $hotwordsScore, ctcFstDecoderConfig: $ctcFstDecoderConfig, ruleFsts: $ruleFsts, ruleFars: $ruleFars, blankPenalty: $blankPenalty)'; |
| 122 | } | 123 | } |
| 123 | 124 | ||
| 124 | final FeatureConfig feat; | 125 | final FeatureConfig feat; |
| @@ -142,6 +143,8 @@ class OnlineRecognizerConfig { | @@ -142,6 +143,8 @@ class OnlineRecognizerConfig { | ||
| 142 | final OnlineCtcFstDecoderConfig ctcFstDecoderConfig; | 143 | final OnlineCtcFstDecoderConfig ctcFstDecoderConfig; |
| 143 | final String ruleFsts; | 144 | final String ruleFsts; |
| 144 | final String ruleFars; | 145 | final String ruleFars; |
| 146 | + | ||
| 147 | + final double blankPenalty; | ||
| 145 | } | 148 | } |
| 146 | 149 | ||
| 147 | class OnlineRecognizerResult { | 150 | class OnlineRecognizerResult { |
| @@ -209,6 +212,8 @@ class OnlineRecognizer { | @@ -209,6 +212,8 @@ class OnlineRecognizer { | ||
| 209 | c.ref.ruleFsts = config.ruleFsts.toNativeUtf8(); | 212 | c.ref.ruleFsts = config.ruleFsts.toNativeUtf8(); |
| 210 | c.ref.ruleFars = config.ruleFars.toNativeUtf8(); | 213 | c.ref.ruleFars = config.ruleFars.toNativeUtf8(); |
| 211 | 214 | ||
| 215 | + c.ref.blankPenalty = config.blankPenalty; | ||
| 216 | + | ||
| 212 | final ptr = SherpaOnnxBindings.createOnlineRecognizer?.call(c) ?? nullptr; | 217 | final ptr = SherpaOnnxBindings.createOnlineRecognizer?.call(c) ?? nullptr; |
| 213 | 218 | ||
| 214 | calloc.free(c.ref.ruleFars); | 219 | calloc.free(c.ref.ruleFars); |
| @@ -194,6 +194,9 @@ final class SherpaOnnxOfflineRecognizerConfig extends Struct { | @@ -194,6 +194,9 @@ final class SherpaOnnxOfflineRecognizerConfig extends Struct { | ||
| 194 | 194 | ||
| 195 | external Pointer<Utf8> ruleFsts; | 195 | external Pointer<Utf8> ruleFsts; |
| 196 | external Pointer<Utf8> ruleFars; | 196 | external Pointer<Utf8> ruleFars; |
| 197 | + | ||
| 198 | + @Float() | ||
| 199 | + external double blankPenalty; | ||
| 197 | } | 200 | } |
| 198 | 201 | ||
| 199 | final class SherpaOnnxOnlineTransducerModelConfig extends Struct { | 202 | final class SherpaOnnxOnlineTransducerModelConfig extends Struct { |
| @@ -269,6 +272,9 @@ final class SherpaOnnxOnlineRecognizerConfig extends Struct { | @@ -269,6 +272,9 @@ final class SherpaOnnxOnlineRecognizerConfig extends Struct { | ||
| 269 | 272 | ||
| 270 | external Pointer<Utf8> ruleFsts; | 273 | external Pointer<Utf8> ruleFsts; |
| 271 | external Pointer<Utf8> ruleFars; | 274 | external Pointer<Utf8> ruleFars; |
| 275 | + | ||
| 276 | + @Float() | ||
| 277 | + external double blankPenalty; | ||
| 272 | } | 278 | } |
| 273 | 279 | ||
| 274 | final class SherpaOnnxSileroVadModelConfig extends Struct { | 280 | final class SherpaOnnxSileroVadModelConfig extends Struct { |
| @@ -17,7 +17,7 @@ topics: | @@ -17,7 +17,7 @@ topics: | ||
| 17 | - voice-activity-detection | 17 | - voice-activity-detection |
| 18 | 18 | ||
| 19 | # remember to change the version in ../sherpa_onnx_macos/macos/sherpa_onnx_macos.podspec | 19 | # remember to change the version in ../sherpa_onnx_macos/macos/sherpa_onnx_macos.podspec |
| 20 | -version: 1.10.20 | 20 | +version: 1.10.21 |
| 21 | 21 | ||
| 22 | homepage: https://github.com/k2-fsa/sherpa-onnx | 22 | homepage: https://github.com/k2-fsa/sherpa-onnx |
| 23 | 23 | ||
| @@ -30,23 +30,23 @@ dependencies: | @@ -30,23 +30,23 @@ dependencies: | ||
| 30 | flutter: | 30 | flutter: |
| 31 | sdk: flutter | 31 | sdk: flutter |
| 32 | 32 | ||
| 33 | - sherpa_onnx_android: ^1.10.20 | 33 | + sherpa_onnx_android: ^1.10.21 |
| 34 | # sherpa_onnx_android: | 34 | # sherpa_onnx_android: |
| 35 | # path: ../sherpa_onnx_android | 35 | # path: ../sherpa_onnx_android |
| 36 | 36 | ||
| 37 | - sherpa_onnx_macos: ^1.10.20 | 37 | + sherpa_onnx_macos: ^1.10.21 |
| 38 | # sherpa_onnx_macos: | 38 | # sherpa_onnx_macos: |
| 39 | # path: ../sherpa_onnx_macos | 39 | # path: ../sherpa_onnx_macos |
| 40 | 40 | ||
| 41 | - sherpa_onnx_linux: ^1.10.20 | 41 | + sherpa_onnx_linux: ^1.10.21 |
| 42 | # sherpa_onnx_linux: | 42 | # sherpa_onnx_linux: |
| 43 | # path: ../sherpa_onnx_linux | 43 | # path: ../sherpa_onnx_linux |
| 44 | # | 44 | # |
| 45 | - sherpa_onnx_windows: ^1.10.20 | 45 | + sherpa_onnx_windows: ^1.10.21 |
| 46 | # sherpa_onnx_windows: | 46 | # sherpa_onnx_windows: |
| 47 | # path: ../sherpa_onnx_windows | 47 | # path: ../sherpa_onnx_windows |
| 48 | 48 | ||
| 49 | - sherpa_onnx_ios: ^1.10.20 | 49 | + sherpa_onnx_ios: ^1.10.21 |
| 50 | # sherpa_onnx_ios: | 50 | # sherpa_onnx_ios: |
| 51 | # path: ../sherpa_onnx_ios | 51 | # path: ../sherpa_onnx_ios |
| 52 | 52 |
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | # https://groups.google.com/g/dart-ffi/c/nUATMBy7r0c | 7 | # https://groups.google.com/g/dart-ffi/c/nUATMBy7r0c |
| 8 | Pod::Spec.new do |s| | 8 | Pod::Spec.new do |s| |
| 9 | s.name = 'sherpa_onnx_ios' | 9 | s.name = 'sherpa_onnx_ios' |
| 10 | - s.version = '1.10.20' | 10 | + s.version = '1.10.21' |
| 11 | s.summary = 'A new Flutter FFI plugin project.' | 11 | s.summary = 'A new Flutter FFI plugin project.' |
| 12 | s.description = <<-DESC | 12 | s.description = <<-DESC |
| 13 | A new Flutter FFI plugin project. | 13 | A new Flutter FFI plugin project. |
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | # | 4 | # |
| 5 | Pod::Spec.new do |s| | 5 | Pod::Spec.new do |s| |
| 6 | s.name = 'sherpa_onnx_macos' | 6 | s.name = 'sherpa_onnx_macos' |
| 7 | - s.version = '1.10.20' | 7 | + s.version = '1.10.21' |
| 8 | s.summary = 'sherpa-onnx Flutter FFI plugin project.' | 8 | s.summary = 'sherpa-onnx Flutter FFI plugin project.' |
| 9 | s.description = <<-DESC | 9 | s.description = <<-DESC |
| 10 | sherpa-onnx Flutter FFI plugin project. | 10 | sherpa-onnx Flutter FFI plugin project. |
| @@ -4,7 +4,6 @@ using System.Runtime.InteropServices; | @@ -4,7 +4,6 @@ using System.Runtime.InteropServices; | ||
| 4 | 4 | ||
| 5 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 6 | { | 6 | { |
| 7 | - | ||
| 8 | [StructLayout(LayoutKind.Sequential)] | 7 | [StructLayout(LayoutKind.Sequential)] |
| 9 | public struct OfflineRecognizerConfig | 8 | public struct OfflineRecognizerConfig |
| 10 | { | 9 | { |
| @@ -20,6 +19,7 @@ namespace SherpaOnnx | @@ -20,6 +19,7 @@ namespace SherpaOnnx | ||
| 20 | HotwordsScore = 1.5F; | 19 | HotwordsScore = 1.5F; |
| 21 | RuleFsts = ""; | 20 | RuleFsts = ""; |
| 22 | RuleFars = ""; | 21 | RuleFars = ""; |
| 22 | + BlankPenalty = 0.0F; | ||
| 23 | } | 23 | } |
| 24 | public FeatureConfig FeatConfig; | 24 | public FeatureConfig FeatConfig; |
| 25 | public OfflineModelConfig ModelConfig; | 25 | public OfflineModelConfig ModelConfig; |
| @@ -40,7 +40,7 @@ namespace SherpaOnnx | @@ -40,7 +40,7 @@ namespace SherpaOnnx | ||
| 40 | 40 | ||
| 41 | [MarshalAs(UnmanagedType.LPStr)] | 41 | [MarshalAs(UnmanagedType.LPStr)] |
| 42 | public string RuleFars; | 42 | public string RuleFars; |
| 43 | - } | ||
| 44 | 43 | ||
| 45 | - | ||
| 46 | -} | ||
| 44 | + public float BlankPenalty; | ||
| 45 | + } | ||
| 46 | +} |
| @@ -25,6 +25,7 @@ namespace SherpaOnnx | @@ -25,6 +25,7 @@ namespace SherpaOnnx | ||
| 25 | CtcFstDecoderConfig = new OnlineCtcFstDecoderConfig(); | 25 | CtcFstDecoderConfig = new OnlineCtcFstDecoderConfig(); |
| 26 | RuleFsts = ""; | 26 | RuleFsts = ""; |
| 27 | RuleFars = ""; | 27 | RuleFars = ""; |
| 28 | + BlankPenalty = 0.0F; | ||
| 28 | } | 29 | } |
| 29 | public FeatureConfig FeatConfig; | 30 | public FeatureConfig FeatConfig; |
| 30 | public OnlineModelConfig ModelConfig; | 31 | public OnlineModelConfig ModelConfig; |
| @@ -69,6 +70,7 @@ namespace SherpaOnnx | @@ -69,6 +70,7 @@ namespace SherpaOnnx | ||
| 69 | 70 | ||
| 70 | [MarshalAs(UnmanagedType.LPStr)] | 71 | [MarshalAs(UnmanagedType.LPStr)] |
| 71 | public string RuleFars; | 72 | public string RuleFars; |
| 72 | - } | ||
| 73 | 73 | ||
| 74 | -} | ||
| 74 | + public float BlankPenalty; | ||
| 75 | + } | ||
| 76 | +} |
| @@ -201,6 +201,7 @@ CreateOfflineRecognizerWrapper(const Napi::CallbackInfo &info) { | @@ -201,6 +201,7 @@ CreateOfflineRecognizerWrapper(const Napi::CallbackInfo &info) { | ||
| 201 | SHERPA_ONNX_ASSIGN_ATTR_FLOAT(hotwords_score, hotwordsScore); | 201 | SHERPA_ONNX_ASSIGN_ATTR_FLOAT(hotwords_score, hotwordsScore); |
| 202 | SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fsts, ruleFsts); | 202 | SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fsts, ruleFsts); |
| 203 | SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fars, ruleFars); | 203 | SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fars, ruleFars); |
| 204 | + SHERPA_ONNX_ASSIGN_ATTR_FLOAT(blank_penalty, blankPenalty); | ||
| 204 | 205 | ||
| 205 | SherpaOnnxOfflineRecognizer *recognizer = | 206 | SherpaOnnxOfflineRecognizer *recognizer = |
| 206 | SherpaOnnxCreateOfflineRecognizer(&c); | 207 | SherpaOnnxCreateOfflineRecognizer(&c); |
| @@ -191,6 +191,7 @@ static Napi::External<SherpaOnnxOnlineRecognizer> CreateOnlineRecognizerWrapper( | @@ -191,6 +191,7 @@ static Napi::External<SherpaOnnxOnlineRecognizer> CreateOnlineRecognizerWrapper( | ||
| 191 | SHERPA_ONNX_ASSIGN_ATTR_FLOAT(hotwords_score, hotwordsScore); | 191 | SHERPA_ONNX_ASSIGN_ATTR_FLOAT(hotwords_score, hotwordsScore); |
| 192 | SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fsts, ruleFsts); | 192 | SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fsts, ruleFsts); |
| 193 | SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fars, ruleFars); | 193 | SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fars, ruleFars); |
| 194 | + SHERPA_ONNX_ASSIGN_ATTR_FLOAT(blank_penalty, blankPenalty); | ||
| 194 | 195 | ||
| 195 | c.ctc_fst_decoder_config = GetCtcFstDecoderConfig(o); | 196 | c.ctc_fst_decoder_config = GetCtcFstDecoderConfig(o); |
| 196 | 197 |
| @@ -105,7 +105,7 @@ SherpaOnnxOnlineRecognizer *SherpaOnnxCreateOnlineRecognizer( | @@ -105,7 +105,7 @@ SherpaOnnxOnlineRecognizer *SherpaOnnxCreateOnlineRecognizer( | ||
| 105 | recognizer_config.hotwords_score = | 105 | recognizer_config.hotwords_score = |
| 106 | SHERPA_ONNX_OR(config->hotwords_score, 1.5); | 106 | SHERPA_ONNX_OR(config->hotwords_score, 1.5); |
| 107 | 107 | ||
| 108 | - recognizer_config.blank_penalty = SHERPA_ONNX_OR(config->blank_penalty, 0.0); | 108 | + recognizer_config.blank_penalty = config->blank_penalty; |
| 109 | 109 | ||
| 110 | recognizer_config.ctc_fst_decoder_config.graph = | 110 | recognizer_config.ctc_fst_decoder_config.graph = |
| 111 | SHERPA_ONNX_OR(config->ctc_fst_decoder_config.graph, ""); | 111 | SHERPA_ONNX_OR(config->ctc_fst_decoder_config.graph, ""); |
| @@ -429,6 +429,8 @@ sherpa_onnx::OfflineRecognizerConfig convertConfig( | @@ -429,6 +429,8 @@ sherpa_onnx::OfflineRecognizerConfig convertConfig( | ||
| 429 | recognizer_config.hotwords_score = | 429 | recognizer_config.hotwords_score = |
| 430 | SHERPA_ONNX_OR(config->hotwords_score, 1.5); | 430 | SHERPA_ONNX_OR(config->hotwords_score, 1.5); |
| 431 | 431 | ||
| 432 | + recognizer_config.blank_penalty = config->blank_penalty; | ||
| 433 | + | ||
| 432 | recognizer_config.rule_fsts = SHERPA_ONNX_OR(config->rule_fsts, ""); | 434 | recognizer_config.rule_fsts = SHERPA_ONNX_OR(config->rule_fsts, ""); |
| 433 | recognizer_config.rule_fars = SHERPA_ONNX_OR(config->rule_fars, ""); | 435 | recognizer_config.rule_fars = SHERPA_ONNX_OR(config->rule_fars, ""); |
| 434 | 436 |
| @@ -142,11 +142,11 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOnlineRecognizerConfig { | @@ -142,11 +142,11 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOnlineRecognizerConfig { | ||
| 142 | 142 | ||
| 143 | /// Bonus score for each token in hotwords. | 143 | /// Bonus score for each token in hotwords. |
| 144 | float hotwords_score; | 144 | float hotwords_score; |
| 145 | - float blank_penalty; | ||
| 146 | 145 | ||
| 147 | SherpaOnnxOnlineCtcFstDecoderConfig ctc_fst_decoder_config; | 146 | SherpaOnnxOnlineCtcFstDecoderConfig ctc_fst_decoder_config; |
| 148 | const char *rule_fsts; | 147 | const char *rule_fsts; |
| 149 | const char *rule_fars; | 148 | const char *rule_fars; |
| 149 | + float blank_penalty; | ||
| 150 | } SherpaOnnxOnlineRecognizerConfig; | 150 | } SherpaOnnxOnlineRecognizerConfig; |
| 151 | 151 | ||
| 152 | SHERPA_ONNX_API typedef struct SherpaOnnxOnlineRecognizerResult { | 152 | SHERPA_ONNX_API typedef struct SherpaOnnxOnlineRecognizerResult { |
| @@ -430,6 +430,7 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizerConfig { | @@ -430,6 +430,7 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizerConfig { | ||
| 430 | float hotwords_score; | 430 | float hotwords_score; |
| 431 | const char *rule_fsts; | 431 | const char *rule_fsts; |
| 432 | const char *rule_fars; | 432 | const char *rule_fars; |
| 433 | + float blank_penalty; | ||
| 433 | } SherpaOnnxOfflineRecognizerConfig; | 434 | } SherpaOnnxOfflineRecognizerConfig; |
| 434 | 435 | ||
| 435 | SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizer | 436 | SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizer |
| @@ -11,6 +11,7 @@ public class OfflineRecognizerConfig { | @@ -11,6 +11,7 @@ public class OfflineRecognizerConfig { | ||
| 11 | private final float hotwordsScore; | 11 | private final float hotwordsScore; |
| 12 | private final String ruleFsts; | 12 | private final String ruleFsts; |
| 13 | private final String ruleFars; | 13 | private final String ruleFars; |
| 14 | + private final float blankPenalty; | ||
| 14 | 15 | ||
| 15 | private OfflineRecognizerConfig(Builder builder) { | 16 | private OfflineRecognizerConfig(Builder builder) { |
| 16 | this.featConfig = builder.featConfig; | 17 | this.featConfig = builder.featConfig; |
| @@ -21,6 +22,7 @@ public class OfflineRecognizerConfig { | @@ -21,6 +22,7 @@ public class OfflineRecognizerConfig { | ||
| 21 | this.hotwordsScore = builder.hotwordsScore; | 22 | this.hotwordsScore = builder.hotwordsScore; |
| 22 | this.ruleFsts = builder.ruleFsts; | 23 | this.ruleFsts = builder.ruleFsts; |
| 23 | this.ruleFars = builder.ruleFars; | 24 | this.ruleFars = builder.ruleFars; |
| 25 | + this.blankPenalty = builder.blankPenalty; | ||
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | public static Builder builder() { | 28 | public static Builder builder() { |
| @@ -40,6 +42,7 @@ public class OfflineRecognizerConfig { | @@ -40,6 +42,7 @@ public class OfflineRecognizerConfig { | ||
| 40 | private float hotwordsScore = 1.5f; | 42 | private float hotwordsScore = 1.5f; |
| 41 | private String ruleFsts = ""; | 43 | private String ruleFsts = ""; |
| 42 | private String ruleFars = ""; | 44 | private String ruleFars = ""; |
| 45 | + private float blankPenalty = 0.0f; | ||
| 43 | 46 | ||
| 44 | public OfflineRecognizerConfig build() { | 47 | public OfflineRecognizerConfig build() { |
| 45 | return new OfflineRecognizerConfig(this); | 48 | return new OfflineRecognizerConfig(this); |
| @@ -84,5 +87,10 @@ public class OfflineRecognizerConfig { | @@ -84,5 +87,10 @@ public class OfflineRecognizerConfig { | ||
| 84 | this.ruleFars = ruleFars; | 87 | this.ruleFars = ruleFars; |
| 85 | return this; | 88 | return this; |
| 86 | } | 89 | } |
| 90 | + | ||
| 91 | + public Builder setBlankPenalty(float blankPenalty) { | ||
| 92 | + this.blankPenalty = blankPenalty; | ||
| 93 | + return this; | ||
| 94 | + } | ||
| 87 | } | 95 | } |
| 88 | } | 96 | } |
| @@ -17,6 +17,7 @@ public class OnlineRecognizerConfig { | @@ -17,6 +17,7 @@ public class OnlineRecognizerConfig { | ||
| 17 | private final float hotwordsScore; | 17 | private final float hotwordsScore; |
| 18 | private final String ruleFsts; | 18 | private final String ruleFsts; |
| 19 | private final String ruleFars; | 19 | private final String ruleFars; |
| 20 | + private final float blankPenalty; | ||
| 20 | 21 | ||
| 21 | private OnlineRecognizerConfig(Builder builder) { | 22 | private OnlineRecognizerConfig(Builder builder) { |
| 22 | this.featConfig = builder.featConfig; | 23 | this.featConfig = builder.featConfig; |
| @@ -31,6 +32,7 @@ public class OnlineRecognizerConfig { | @@ -31,6 +32,7 @@ public class OnlineRecognizerConfig { | ||
| 31 | this.hotwordsScore = builder.hotwordsScore; | 32 | this.hotwordsScore = builder.hotwordsScore; |
| 32 | this.ruleFsts = builder.ruleFsts; | 33 | this.ruleFsts = builder.ruleFsts; |
| 33 | this.ruleFars = builder.ruleFars; | 34 | this.ruleFars = builder.ruleFars; |
| 35 | + this.blankPenalty = builder.blankPenalty; | ||
| 34 | } | 36 | } |
| 35 | 37 | ||
| 36 | public static Builder builder() { | 38 | public static Builder builder() { |
| @@ -54,6 +56,7 @@ public class OnlineRecognizerConfig { | @@ -54,6 +56,7 @@ public class OnlineRecognizerConfig { | ||
| 54 | private float hotwordsScore = 1.5f; | 56 | private float hotwordsScore = 1.5f; |
| 55 | private String ruleFsts = ""; | 57 | private String ruleFsts = ""; |
| 56 | private String ruleFars = ""; | 58 | private String ruleFars = ""; |
| 59 | + private float blankPenalty = 0.0f; | ||
| 57 | 60 | ||
| 58 | public OnlineRecognizerConfig build() { | 61 | public OnlineRecognizerConfig build() { |
| 59 | return new OnlineRecognizerConfig(this); | 62 | return new OnlineRecognizerConfig(this); |
| @@ -118,5 +121,10 @@ public class OnlineRecognizerConfig { | @@ -118,5 +121,10 @@ public class OnlineRecognizerConfig { | ||
| 118 | this.ruleFars = ruleFars; | 121 | this.ruleFars = ruleFars; |
| 119 | return this; | 122 | return this; |
| 120 | } | 123 | } |
| 124 | + | ||
| 125 | + public Builder setBlankPenalty(float blankPenalty) { | ||
| 126 | + this.blankPenalty = blankPenalty; | ||
| 127 | + return this; | ||
| 128 | + } | ||
| 121 | } | 129 | } |
| 122 | } | 130 | } |
| @@ -46,6 +46,9 @@ static OfflineRecognizerConfig GetOfflineConfig(JNIEnv *env, jobject config) { | @@ -46,6 +46,9 @@ static OfflineRecognizerConfig GetOfflineConfig(JNIEnv *env, jobject config) { | ||
| 46 | ans.rule_fars = p; | 46 | ans.rule_fars = p; |
| 47 | env->ReleaseStringUTFChars(s, p); | 47 | env->ReleaseStringUTFChars(s, p); |
| 48 | 48 | ||
| 49 | + fid = env->GetFieldID(cls, "blankPenalty", "F"); | ||
| 50 | + ans.blank_penalty = env->GetFloatField(config, fid); | ||
| 51 | + | ||
| 49 | //---------- feat config ---------- | 52 | //---------- feat config ---------- |
| 50 | fid = env->GetFieldID(cls, "featConfig", | 53 | fid = env->GetFieldID(cls, "featConfig", |
| 51 | "Lcom/k2fsa/sherpa/onnx/FeatureConfig;"); | 54 | "Lcom/k2fsa/sherpa/onnx/FeatureConfig;"); |
| @@ -49,6 +49,9 @@ static OnlineRecognizerConfig GetConfig(JNIEnv *env, jobject config) { | @@ -49,6 +49,9 @@ static OnlineRecognizerConfig GetConfig(JNIEnv *env, jobject config) { | ||
| 49 | ans.rule_fars = p; | 49 | ans.rule_fars = p; |
| 50 | env->ReleaseStringUTFChars(s, p); | 50 | env->ReleaseStringUTFChars(s, p); |
| 51 | 51 | ||
| 52 | + fid = env->GetFieldID(cls, "blankPenalty", "F"); | ||
| 53 | + ans.blank_penalty = env->GetFloatField(config, fid); | ||
| 54 | + | ||
| 52 | //---------- feat config ---------- | 55 | //---------- feat config ---------- |
| 53 | fid = env->GetFieldID(cls, "featConfig", | 56 | fid = env->GetFieldID(cls, "featConfig", |
| 54 | "Lcom/k2fsa/sherpa/onnx/FeatureConfig;"); | 57 | "Lcom/k2fsa/sherpa/onnx/FeatureConfig;"); |
| @@ -62,6 +62,7 @@ data class OfflineRecognizerConfig( | @@ -62,6 +62,7 @@ data class OfflineRecognizerConfig( | ||
| 62 | var hotwordsScore: Float = 1.5f, | 62 | var hotwordsScore: Float = 1.5f, |
| 63 | var ruleFsts: String = "", | 63 | var ruleFsts: String = "", |
| 64 | var ruleFars: String = "", | 64 | var ruleFars: String = "", |
| 65 | + var blankPenalty: Float = 0.0f, | ||
| 65 | ) | 66 | ) |
| 66 | 67 | ||
| 67 | class OfflineRecognizer( | 68 | class OfflineRecognizer( |
| @@ -71,6 +71,7 @@ data class OnlineRecognizerConfig( | @@ -71,6 +71,7 @@ data class OnlineRecognizerConfig( | ||
| 71 | var hotwordsScore: Float = 1.5f, | 71 | var hotwordsScore: Float = 1.5f, |
| 72 | var ruleFsts: String = "", | 72 | var ruleFsts: String = "", |
| 73 | var ruleFars: String = "", | 73 | var ruleFars: String = "", |
| 74 | + var blankPenalty: Float = 0.0f, | ||
| 74 | ) | 75 | ) |
| 75 | 76 | ||
| 76 | data class OnlineRecognizerResult( | 77 | data class OnlineRecognizerResult( |
| @@ -137,7 +137,8 @@ func sherpaOnnxOnlineRecognizerConfig( | @@ -137,7 +137,8 @@ func sherpaOnnxOnlineRecognizerConfig( | ||
| 137 | hotwordsScore: Float = 1.5, | 137 | hotwordsScore: Float = 1.5, |
| 138 | ctcFstDecoderConfig: SherpaOnnxOnlineCtcFstDecoderConfig = sherpaOnnxOnlineCtcFstDecoderConfig(), | 138 | ctcFstDecoderConfig: SherpaOnnxOnlineCtcFstDecoderConfig = sherpaOnnxOnlineCtcFstDecoderConfig(), |
| 139 | ruleFsts: String = "", | 139 | ruleFsts: String = "", |
| 140 | - ruleFars: String = "" | 140 | + ruleFars: String = "", |
| 141 | + blankPenalty: Float = 0.0 | ||
| 141 | ) -> SherpaOnnxOnlineRecognizerConfig { | 142 | ) -> SherpaOnnxOnlineRecognizerConfig { |
| 142 | return SherpaOnnxOnlineRecognizerConfig( | 143 | return SherpaOnnxOnlineRecognizerConfig( |
| 143 | feat_config: featConfig, | 144 | feat_config: featConfig, |
| @@ -152,7 +153,8 @@ func sherpaOnnxOnlineRecognizerConfig( | @@ -152,7 +153,8 @@ func sherpaOnnxOnlineRecognizerConfig( | ||
| 152 | hotwords_score: hotwordsScore, | 153 | hotwords_score: hotwordsScore, |
| 153 | ctc_fst_decoder_config: ctcFstDecoderConfig, | 154 | ctc_fst_decoder_config: ctcFstDecoderConfig, |
| 154 | rule_fsts: toCPointer(ruleFsts), | 155 | rule_fsts: toCPointer(ruleFsts), |
| 155 | - rule_fars: toCPointer(ruleFars) | 156 | + rule_fars: toCPointer(ruleFars), |
| 157 | + blank_penalty: blankPenalty | ||
| 156 | ) | 158 | ) |
| 157 | } | 159 | } |
| 158 | 160 | ||
| @@ -420,7 +422,8 @@ func sherpaOnnxOfflineRecognizerConfig( | @@ -420,7 +422,8 @@ func sherpaOnnxOfflineRecognizerConfig( | ||
| 420 | hotwordsFile: String = "", | 422 | hotwordsFile: String = "", |
| 421 | hotwordsScore: Float = 1.5, | 423 | hotwordsScore: Float = 1.5, |
| 422 | ruleFsts: String = "", | 424 | ruleFsts: String = "", |
| 423 | - ruleFars: String = "" | 425 | + ruleFars: String = "", |
| 426 | + blankPenalty: Float = 0.0 | ||
| 424 | ) -> SherpaOnnxOfflineRecognizerConfig { | 427 | ) -> SherpaOnnxOfflineRecognizerConfig { |
| 425 | return SherpaOnnxOfflineRecognizerConfig( | 428 | return SherpaOnnxOfflineRecognizerConfig( |
| 426 | feat_config: featConfig, | 429 | feat_config: featConfig, |
| @@ -431,7 +434,8 @@ func sherpaOnnxOfflineRecognizerConfig( | @@ -431,7 +434,8 @@ func sherpaOnnxOfflineRecognizerConfig( | ||
| 431 | hotwords_file: toCPointer(hotwordsFile), | 434 | hotwords_file: toCPointer(hotwordsFile), |
| 432 | hotwords_score: hotwordsScore, | 435 | hotwords_score: hotwordsScore, |
| 433 | rule_fsts: toCPointer(ruleFsts), | 436 | rule_fsts: toCPointer(ruleFsts), |
| 434 | - rule_fars: toCPointer(ruleFars) | 437 | + rule_fars: toCPointer(ruleFars), |
| 438 | + blank_penalty: blankPenalty | ||
| 435 | ) | 439 | ) |
| 436 | } | 440 | } |
| 437 | 441 |
| @@ -280,7 +280,7 @@ function initSherpaOnnxOnlineRecognizerConfig(config, Module) { | @@ -280,7 +280,7 @@ function initSherpaOnnxOnlineRecognizerConfig(config, Module) { | ||
| 280 | const ctcFstDecoder = initSherpaOnnxOnlineCtcFstDecoderConfig( | 280 | const ctcFstDecoder = initSherpaOnnxOnlineCtcFstDecoderConfig( |
| 281 | config.ctcFstDecoderConfig, Module) | 281 | config.ctcFstDecoderConfig, Module) |
| 282 | 282 | ||
| 283 | - const len = feat.len + model.len + 8 * 4 + ctcFstDecoder.len + 2 * 4; | 283 | + const len = feat.len + model.len + 8 * 4 + ctcFstDecoder.len + 3 * 4; |
| 284 | const ptr = Module._malloc(len); | 284 | const ptr = Module._malloc(len); |
| 285 | 285 | ||
| 286 | let offset = 0; | 286 | let offset = 0; |
| @@ -351,6 +351,9 @@ function initSherpaOnnxOnlineRecognizerConfig(config, Module) { | @@ -351,6 +351,9 @@ function initSherpaOnnxOnlineRecognizerConfig(config, Module) { | ||
| 351 | buffer + decodingMethodLen + hotwordsFileLen + ruleFstsFileLen, 'i8*'); | 351 | buffer + decodingMethodLen + hotwordsFileLen + ruleFstsFileLen, 'i8*'); |
| 352 | offset += 4; | 352 | offset += 4; |
| 353 | 353 | ||
| 354 | + Module.setValue(ptr + offset, config.blankPenalty || 0, 'float'); | ||
| 355 | + offset += 4; | ||
| 356 | + | ||
| 354 | return { | 357 | return { |
| 355 | buffer: buffer, ptr: ptr, len: len, feat: feat, model: model, | 358 | buffer: buffer, ptr: ptr, len: len, feat: feat, model: model, |
| 356 | ctcFstDecoder: ctcFstDecoder | 359 | ctcFstDecoder: ctcFstDecoder |
| @@ -796,7 +799,7 @@ function initSherpaOnnxOfflineRecognizerConfig(config, Module) { | @@ -796,7 +799,7 @@ function initSherpaOnnxOfflineRecognizerConfig(config, Module) { | ||
| 796 | const model = initSherpaOnnxOfflineModelConfig(config.modelConfig, Module); | 799 | const model = initSherpaOnnxOfflineModelConfig(config.modelConfig, Module); |
| 797 | const lm = initSherpaOnnxOfflineLMConfig(config.lmConfig, Module); | 800 | const lm = initSherpaOnnxOfflineLMConfig(config.lmConfig, Module); |
| 798 | 801 | ||
| 799 | - const len = feat.len + model.len + lm.len + 6 * 4; | 802 | + const len = feat.len + model.len + lm.len + 7 * 4; |
| 800 | const ptr = Module._malloc(len); | 803 | const ptr = Module._malloc(len); |
| 801 | 804 | ||
| 802 | let offset = 0; | 805 | let offset = 0; |
| @@ -856,6 +859,9 @@ function initSherpaOnnxOfflineRecognizerConfig(config, Module) { | @@ -856,6 +859,9 @@ function initSherpaOnnxOfflineRecognizerConfig(config, Module) { | ||
| 856 | 'i8*'); | 859 | 'i8*'); |
| 857 | offset += 4; | 860 | offset += 4; |
| 858 | 861 | ||
| 862 | + Module.setValue(ptr + offset, config.blankPenalty || 0, 'float'); | ||
| 863 | + offset += 4; | ||
| 864 | + | ||
| 859 | return { | 865 | return { |
| 860 | buffer: buffer, ptr: ptr, len: len, feat: feat, model: model, lm: lm | 866 | buffer: buffer, ptr: ptr, len: len, feat: feat, model: model, lm: lm |
| 861 | } | 867 | } |
| @@ -26,7 +26,7 @@ static_assert(sizeof(SherpaOnnxOnlineCtcFstDecoderConfig) == 2 * 4, ""); | @@ -26,7 +26,7 @@ static_assert(sizeof(SherpaOnnxOnlineCtcFstDecoderConfig) == 2 * 4, ""); | ||
| 26 | static_assert(sizeof(SherpaOnnxOnlineRecognizerConfig) == | 26 | static_assert(sizeof(SherpaOnnxOnlineRecognizerConfig) == |
| 27 | sizeof(SherpaOnnxFeatureConfig) + | 27 | sizeof(SherpaOnnxFeatureConfig) + |
| 28 | sizeof(SherpaOnnxOnlineModelConfig) + 8 * 4 + | 28 | sizeof(SherpaOnnxOnlineModelConfig) + 8 * 4 + |
| 29 | - sizeof(SherpaOnnxOnlineCtcFstDecoderConfig) + 2 * 4, | 29 | + sizeof(SherpaOnnxOnlineCtcFstDecoderConfig) + 3 * 4, |
| 30 | ""); | 30 | ""); |
| 31 | 31 | ||
| 32 | void MyPrint(SherpaOnnxOnlineRecognizerConfig *config) { | 32 | void MyPrint(SherpaOnnxOnlineRecognizerConfig *config) { |
| @@ -73,6 +73,7 @@ void MyPrint(SherpaOnnxOnlineRecognizerConfig *config) { | @@ -73,6 +73,7 @@ void MyPrint(SherpaOnnxOnlineRecognizerConfig *config) { | ||
| 73 | fprintf(stdout, "hotwords_score: %.2f\n", config->hotwords_score); | 73 | fprintf(stdout, "hotwords_score: %.2f\n", config->hotwords_score); |
| 74 | fprintf(stdout, "rule_fsts: %s\n", config->rule_fsts); | 74 | fprintf(stdout, "rule_fsts: %s\n", config->rule_fsts); |
| 75 | fprintf(stdout, "rule_fars: %s\n", config->rule_fars); | 75 | fprintf(stdout, "rule_fars: %s\n", config->rule_fars); |
| 76 | + fprintf(stdout, "blank_penalty: %f\n", config->blank_penalty); | ||
| 76 | 77 | ||
| 77 | fprintf(stdout, "----------ctc fst decoder config----------\n"); | 78 | fprintf(stdout, "----------ctc fst decoder config----------\n"); |
| 78 | fprintf(stdout, "graph: %s\n", config->ctc_fst_decoder_config.graph); | 79 | fprintf(stdout, "graph: %s\n", config->ctc_fst_decoder_config.graph); |
| @@ -31,7 +31,7 @@ static_assert(sizeof(SherpaOnnxFeatureConfig) == 2 * 4, ""); | @@ -31,7 +31,7 @@ static_assert(sizeof(SherpaOnnxFeatureConfig) == 2 * 4, ""); | ||
| 31 | static_assert(sizeof(SherpaOnnxOfflineRecognizerConfig) == | 31 | static_assert(sizeof(SherpaOnnxOfflineRecognizerConfig) == |
| 32 | sizeof(SherpaOnnxFeatureConfig) + | 32 | sizeof(SherpaOnnxFeatureConfig) + |
| 33 | sizeof(SherpaOnnxOfflineLMConfig) + | 33 | sizeof(SherpaOnnxOfflineLMConfig) + |
| 34 | - sizeof(SherpaOnnxOfflineModelConfig) + 6 * 4, | 34 | + sizeof(SherpaOnnxOfflineModelConfig) + 7 * 4, |
| 35 | ""); | 35 | ""); |
| 36 | 36 | ||
| 37 | void PrintOfflineTtsConfig(SherpaOnnxOfflineTtsConfig *tts_config) { | 37 | void PrintOfflineTtsConfig(SherpaOnnxOfflineTtsConfig *tts_config) { |
| @@ -113,6 +113,7 @@ void PrintOfflineRecognizerConfig(SherpaOnnxOfflineRecognizerConfig *config) { | @@ -113,6 +113,7 @@ void PrintOfflineRecognizerConfig(SherpaOnnxOfflineRecognizerConfig *config) { | ||
| 113 | fprintf(stdout, "hotwords_score: %.2f\n", config->hotwords_score); | 113 | fprintf(stdout, "hotwords_score: %.2f\n", config->hotwords_score); |
| 114 | fprintf(stdout, "rule_fsts: %s\n", config->rule_fsts); | 114 | fprintf(stdout, "rule_fsts: %s\n", config->rule_fsts); |
| 115 | fprintf(stdout, "rule_fars: %s\n", config->rule_fars); | 115 | fprintf(stdout, "rule_fars: %s\n", config->rule_fars); |
| 116 | + fprintf(stdout, "blank_penalty: %f\n", config->blank_penalty); | ||
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | void CopyHeap(const char *src, int32_t num_bytes, char *dst) { | 119 | void CopyHeap(const char *src, int32_t num_bytes, char *dst) { |
-
请 注册 或 登录 后发表评论