add blank_penalty for offline transducer (#542)

This commit is contained in:
chiiyeh
2024-01-25 15:00:09 +08:00
committed by GitHub
parent a9e7747736
commit 3bb3849ec5
13 changed files with 97 additions and 14 deletions

View File

@@ -37,6 +37,8 @@ struct OfflineRecognizerConfig {
std::string hotwords_file;
float hotwords_score = 1.5;
float blank_penalty = 0.0;
// only greedy_search is implemented
// TODO(fangjun): Implement modified_beam_search
@@ -46,7 +48,8 @@ struct OfflineRecognizerConfig {
const OfflineModelConfig &model_config, const OfflineLMConfig &lm_config,
const OfflineCtcFstDecoderConfig &ctc_fst_decoder_config,
const std::string &decoding_method, int32_t max_active_paths,
const std::string &hotwords_file, float hotwords_score)
const std::string &hotwords_file, float hotwords_score,
float blank_penalty)
: feat_config(feat_config),
model_config(model_config),
lm_config(lm_config),
@@ -54,7 +57,8 @@ struct OfflineRecognizerConfig {
decoding_method(decoding_method),
max_active_paths(max_active_paths),
hotwords_file(hotwords_file),
hotwords_score(hotwords_score) {}
hotwords_score(hotwords_score),
blank_penalty(blank_penalty) {}
void Register(ParseOptions *po);
bool Validate() const;