Support getting word IDs for CTC HLG decoding. (#978)

This commit is contained in:
Fangjun Kuang
2024-06-06 14:22:39 +08:00
committed by GitHub
parent 69347ffc8f
commit 1a43d1e37f
13 changed files with 60 additions and 13 deletions

View File

@@ -51,9 +51,9 @@ static void DecodeOne(const float *log_probs, int32_t num_rows,
bool ok = decoder->GetBestPath(&fst_out);
if (ok) {
std::vector<int32_t> isymbols_out;
std::vector<int32_t> osymbols_out_unused;
ok = fst::GetLinearSymbolSequence(fst_out, &isymbols_out,
&osymbols_out_unused, nullptr);
std::vector<int32_t> osymbols_out;
ok = fst::GetLinearSymbolSequence(fst_out, &isymbols_out, &osymbols_out,
nullptr);
std::vector<int64_t> tokens;
tokens.reserve(isymbols_out.size());
@@ -83,6 +83,7 @@ static void DecodeOne(const float *log_probs, int32_t num_rows,
}
result->tokens = std::move(tokens);
result->words = std::move(osymbols_out);
result->timestamps = std::move(timestamps);
// no need to set frame_offset
}