Add blank penalty for various language bindings. (#1234)
This commit is contained in:
@@ -159,11 +159,12 @@ class OfflineRecognizerConfig {
|
||||
this.hotwordsScore = 1.5,
|
||||
this.ruleFsts = '',
|
||||
this.ruleFars = '',
|
||||
this.blankPenalty = 0.0,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'OfflineRecognizerConfig(feat: $feat, model: $model, lm: $lm, decodingMethod: $decodingMethod, maxActivePaths: $maxActivePaths, hotwordsFile: $hotwordsFile, hotwordsScore: $hotwordsScore, ruleFsts: $ruleFsts, ruleFars: $ruleFars)';
|
||||
return 'OfflineRecognizerConfig(feat: $feat, model: $model, lm: $lm, decodingMethod: $decodingMethod, maxActivePaths: $maxActivePaths, hotwordsFile: $hotwordsFile, hotwordsScore: $hotwordsScore, ruleFsts: $ruleFsts, ruleFars: $ruleFars, blankPenalty: $blankPenalty)';
|
||||
}
|
||||
|
||||
final FeatureConfig feat;
|
||||
@@ -179,6 +180,8 @@ class OfflineRecognizerConfig {
|
||||
|
||||
final String ruleFsts;
|
||||
final String ruleFars;
|
||||
|
||||
final double blankPenalty;
|
||||
}
|
||||
|
||||
class OfflineRecognizerResult {
|
||||
@@ -268,6 +271,8 @@ class OfflineRecognizer {
|
||||
c.ref.ruleFsts = config.ruleFsts.toNativeUtf8();
|
||||
c.ref.ruleFars = config.ruleFars.toNativeUtf8();
|
||||
|
||||
c.ref.blankPenalty = config.blankPenalty;
|
||||
|
||||
final ptr = SherpaOnnxBindings.createOfflineRecognizer?.call(c) ?? nullptr;
|
||||
|
||||
calloc.free(c.ref.ruleFars);
|
||||
|
||||
@@ -114,11 +114,12 @@ class OnlineRecognizerConfig {
|
||||
this.ctcFstDecoderConfig = const OnlineCtcFstDecoderConfig(),
|
||||
this.ruleFsts = '',
|
||||
this.ruleFars = '',
|
||||
this.blankPenalty = 0.0,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
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)';
|
||||
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)';
|
||||
}
|
||||
|
||||
final FeatureConfig feat;
|
||||
@@ -142,6 +143,8 @@ class OnlineRecognizerConfig {
|
||||
final OnlineCtcFstDecoderConfig ctcFstDecoderConfig;
|
||||
final String ruleFsts;
|
||||
final String ruleFars;
|
||||
|
||||
final double blankPenalty;
|
||||
}
|
||||
|
||||
class OnlineRecognizerResult {
|
||||
@@ -209,6 +212,8 @@ class OnlineRecognizer {
|
||||
c.ref.ruleFsts = config.ruleFsts.toNativeUtf8();
|
||||
c.ref.ruleFars = config.ruleFars.toNativeUtf8();
|
||||
|
||||
c.ref.blankPenalty = config.blankPenalty;
|
||||
|
||||
final ptr = SherpaOnnxBindings.createOnlineRecognizer?.call(c) ?? nullptr;
|
||||
|
||||
calloc.free(c.ref.ruleFars);
|
||||
|
||||
@@ -194,6 +194,9 @@ final class SherpaOnnxOfflineRecognizerConfig extends Struct {
|
||||
|
||||
external Pointer<Utf8> ruleFsts;
|
||||
external Pointer<Utf8> ruleFars;
|
||||
|
||||
@Float()
|
||||
external double blankPenalty;
|
||||
}
|
||||
|
||||
final class SherpaOnnxOnlineTransducerModelConfig extends Struct {
|
||||
@@ -269,6 +272,9 @@ final class SherpaOnnxOnlineRecognizerConfig extends Struct {
|
||||
|
||||
external Pointer<Utf8> ruleFsts;
|
||||
external Pointer<Utf8> ruleFars;
|
||||
|
||||
@Float()
|
||||
external double blankPenalty;
|
||||
}
|
||||
|
||||
final class SherpaOnnxSileroVadModelConfig extends Struct {
|
||||
|
||||
@@ -17,7 +17,7 @@ topics:
|
||||
- voice-activity-detection
|
||||
|
||||
# remember to change the version in ../sherpa_onnx_macos/macos/sherpa_onnx_macos.podspec
|
||||
version: 1.10.20
|
||||
version: 1.10.21
|
||||
|
||||
homepage: https://github.com/k2-fsa/sherpa-onnx
|
||||
|
||||
@@ -30,23 +30,23 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
sherpa_onnx_android: ^1.10.20
|
||||
sherpa_onnx_android: ^1.10.21
|
||||
# sherpa_onnx_android:
|
||||
# path: ../sherpa_onnx_android
|
||||
|
||||
sherpa_onnx_macos: ^1.10.20
|
||||
sherpa_onnx_macos: ^1.10.21
|
||||
# sherpa_onnx_macos:
|
||||
# path: ../sherpa_onnx_macos
|
||||
|
||||
sherpa_onnx_linux: ^1.10.20
|
||||
sherpa_onnx_linux: ^1.10.21
|
||||
# sherpa_onnx_linux:
|
||||
# path: ../sherpa_onnx_linux
|
||||
#
|
||||
sherpa_onnx_windows: ^1.10.20
|
||||
sherpa_onnx_windows: ^1.10.21
|
||||
# sherpa_onnx_windows:
|
||||
# path: ../sherpa_onnx_windows
|
||||
|
||||
sherpa_onnx_ios: ^1.10.20
|
||||
sherpa_onnx_ios: ^1.10.21
|
||||
# sherpa_onnx_ios:
|
||||
# path: ../sherpa_onnx_ios
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
# https://groups.google.com/g/dart-ffi/c/nUATMBy7r0c
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'sherpa_onnx_ios'
|
||||
s.version = '1.10.20'
|
||||
s.version = '1.10.21'
|
||||
s.summary = 'A new Flutter FFI plugin project.'
|
||||
s.description = <<-DESC
|
||||
A new Flutter FFI plugin project.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'sherpa_onnx_macos'
|
||||
s.version = '1.10.20'
|
||||
s.version = '1.10.21'
|
||||
s.summary = 'sherpa-onnx Flutter FFI plugin project.'
|
||||
s.description = <<-DESC
|
||||
sherpa-onnx Flutter FFI plugin project.
|
||||
|
||||
Reference in New Issue
Block a user