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

@@ -131,8 +131,9 @@ OfflineTransducerModifiedBeamSearchDecoder::Decode(
float context_score = 0;
auto context_state = new_hyp.context_state;
if (new_token != 0) {
// blank id is fixed to 0
// blank is hardcoded to 0
// also, it treats unk as blank
if (new_token != 0 && new_token != unk_id_) {
new_hyp.ys.push_back(new_token);
new_hyp.timestamps.push_back(t);
if (context_graphs[i] != nullptr) {