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);
|
||||
|
||||
Reference in New Issue
Block a user