offline transducer: treat unk as blank (#1005)

Co-authored-by: chungyi.li <chungyi.li@ailabs.tw>
This commit is contained in:
Zhong-Yi Li
2024-06-19 20:52:42 +08:00
committed by GitHub
parent a11c859971
commit 675fb1574f
5 changed files with 25 additions and 9 deletions

View File

@@ -19,12 +19,13 @@ class OfflineTransducerModifiedBeamSearchDecoder
OfflineTransducerModifiedBeamSearchDecoder(OfflineTransducerModel *model,
OfflineLM *lm,
int32_t max_active_paths,
float lm_scale,
float lm_scale, int32_t unk_id,
float blank_penalty)
: model_(model),
lm_(lm),
max_active_paths_(max_active_paths),
lm_scale_(lm_scale),
unk_id_(unk_id),
blank_penalty_(blank_penalty) {}
std::vector<OfflineTransducerDecoderResult> Decode(
@@ -37,6 +38,7 @@ class OfflineTransducerModifiedBeamSearchDecoder
int32_t max_active_paths_;
float lm_scale_; // used only when lm_ is not nullptr
int32_t unk_id_;
float blank_penalty_;
};