Add blank penalty for various language bindings. (#1234)
This commit is contained in:
@@ -4,7 +4,6 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace SherpaOnnx
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct OfflineRecognizerConfig
|
||||
{
|
||||
@@ -20,6 +19,7 @@ namespace SherpaOnnx
|
||||
HotwordsScore = 1.5F;
|
||||
RuleFsts = "";
|
||||
RuleFars = "";
|
||||
BlankPenalty = 0.0F;
|
||||
}
|
||||
public FeatureConfig FeatConfig;
|
||||
public OfflineModelConfig ModelConfig;
|
||||
@@ -40,7 +40,7 @@ namespace SherpaOnnx
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string RuleFars;
|
||||
|
||||
public float BlankPenalty;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace SherpaOnnx
|
||||
CtcFstDecoderConfig = new OnlineCtcFstDecoderConfig();
|
||||
RuleFsts = "";
|
||||
RuleFars = "";
|
||||
BlankPenalty = 0.0F;
|
||||
}
|
||||
public FeatureConfig FeatConfig;
|
||||
public OnlineModelConfig ModelConfig;
|
||||
@@ -69,6 +70,7 @@ namespace SherpaOnnx
|
||||
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string RuleFars;
|
||||
}
|
||||
|
||||
}
|
||||
public float BlankPenalty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,6 +201,7 @@ CreateOfflineRecognizerWrapper(const Napi::CallbackInfo &info) {
|
||||
SHERPA_ONNX_ASSIGN_ATTR_FLOAT(hotwords_score, hotwordsScore);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fsts, ruleFsts);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fars, ruleFars);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_FLOAT(blank_penalty, blankPenalty);
|
||||
|
||||
SherpaOnnxOfflineRecognizer *recognizer =
|
||||
SherpaOnnxCreateOfflineRecognizer(&c);
|
||||
|
||||
@@ -191,6 +191,7 @@ static Napi::External<SherpaOnnxOnlineRecognizer> CreateOnlineRecognizerWrapper(
|
||||
SHERPA_ONNX_ASSIGN_ATTR_FLOAT(hotwords_score, hotwordsScore);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fsts, ruleFsts);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_STR(rule_fars, ruleFars);
|
||||
SHERPA_ONNX_ASSIGN_ATTR_FLOAT(blank_penalty, blankPenalty);
|
||||
|
||||
c.ctc_fst_decoder_config = GetCtcFstDecoderConfig(o);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user