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

@@ -34,6 +34,8 @@ static void PybindOfflineRecognitionResult(py::module *m) { // NOLINT
})
.def_property_readonly("tokens",
[](const PyClass &self) { return self.tokens; })
.def_property_readonly("words",
[](const PyClass &self) { return self.words; })
.def_property_readonly(
"timestamps", [](const PyClass &self) { return self.timestamps; });
}

View File

@@ -40,6 +40,9 @@ static void PybindOnlineRecognizerResult(py::module *m) {
})
.def_property_readonly(
"segment", [](PyClass &self) -> int32_t { return self.segment; })
.def_property_readonly(
"words",
[](PyClass &self) -> std::vector<int32_t> { return self.words; })
.def_property_readonly(
"is_final", [](PyClass &self) -> bool { return self.is_final; })
.def("__str__", &PyClass::AsJsonString,