Add endpointing (#54)

This commit is contained in:
Fangjun Kuang
2023-02-22 15:35:55 +08:00
committed by GitHub
parent 1c6f79f096
commit 124384369a
23 changed files with 2190 additions and 21 deletions

View File

@@ -21,11 +21,15 @@ static void PybindOnlineRecognizerConfig(py::module *m) {
using PyClass = OnlineRecognizerConfig;
py::class_<PyClass>(*m, "OnlineRecognizerConfig")
.def(py::init<const FeatureExtractorConfig &,
const OnlineTransducerModelConfig &, const std::string &>(),
py::arg("feat_config"), py::arg("model_config"), py::arg("tokens"))
const OnlineTransducerModelConfig &, const std::string &,
const EndpointConfig &, bool>(),
py::arg("feat_config"), py::arg("model_config"), py::arg("tokens"),
py::arg("endpoint_config"), py::arg("enable_endpoint"))
.def_readwrite("feat_config", &PyClass::feat_config)
.def_readwrite("model_config", &PyClass::model_config)
.def_readwrite("tokens", &PyClass::tokens)
.def_readwrite("endpoint_config", &PyClass::endpoint_config)
.def_readwrite("enable_endpoint", &PyClass::enable_endpoint)
.def("__str__", &PyClass::ToString);
}
@@ -43,7 +47,9 @@ void PybindOnlineRecognizer(py::module *m) {
[](PyClass &self, std::vector<OnlineStream *> ss) {
self.DecodeStreams(ss.data(), ss.size());
})
.def("get_result", &PyClass::GetResult);
.def("get_result", &PyClass::GetResult)
.def("is_endpoint", &PyClass::IsEndpoint)
.def("reset", &PyClass::Reset);
}
} // namespace sherpa_onnx