Support getting word IDs for CTC HLG decoding. (#978)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user