diff --git a/sherpa-onnx/c-api/c-api.h b/sherpa-onnx/c-api/c-api.h index 11dba9816..67746e587 100644 --- a/sherpa-onnx/c-api/c-api.h +++ b/sherpa-onnx/c-api/c-api.h @@ -91,7 +91,7 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOnlineModelConfig { /// if non-null, loading the tokens from the buffered string directly in /// prioriy const char *tokens_buf; - /// byte size excluding the tailing '\0' + /// byte size excluding the trailing '\0' int32_t tokens_buf_size; } SherpaOnnxOnlineModelConfig; diff --git a/sherpa-onnx/csrc/online-recognizer-transducer-impl.h b/sherpa-onnx/csrc/online-recognizer-transducer-impl.h index 503472e04..50af6b987 100644 --- a/sherpa-onnx/csrc/online-recognizer-transducer-impl.h +++ b/sherpa-onnx/csrc/online-recognizer-transducer-impl.h @@ -372,7 +372,8 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl { // segment is incremented only when the last // result is not empty, contains non-blanks and longer than context_size) const auto &r = s->GetResult(); - if (!r.tokens.empty() && r.tokens.back() != 0 && r.tokens.size() > context_size) { + if (!r.tokens.empty() && r.tokens.back() != 0 && + r.tokens.size() > context_size) { s->GetCurrentSegment() += 1; } } @@ -392,7 +393,8 @@ class OnlineRecognizerTransducerImpl : public OnlineRecognizerImpl { // if last result is not empty, then // preserve last tokens as the context for next result if (static_cast(last_result.tokens.size()) > context_size) { - std::vector context(last_result.tokens.end() - context_size, last_result.tokens.end()); + std::vector context(last_result.tokens.end() - context_size, + last_result.tokens.end()); Hypotheses context_hyp({{context, 0}}); r.hyps = std::move(context_hyp); diff --git a/sherpa-onnx/python/csrc/online-punctuation.cc b/sherpa-onnx/python/csrc/online-punctuation.cc index 13aa66b64..decd16f9a 100644 --- a/sherpa-onnx/python/csrc/online-punctuation.cc +++ b/sherpa-onnx/python/csrc/online-punctuation.cc @@ -4,6 +4,8 @@ #include "sherpa-onnx/python/csrc/online-punctuation.h" +#include + #include "sherpa-onnx/csrc/online-punctuation.h" namespace sherpa_onnx { @@ -12,9 +14,11 @@ static void PybindOnlinePunctuationModelConfig(py::module *m) { using PyClass = OnlinePunctuationModelConfig; py::class_(*m, "OnlinePunctuationModelConfig") .def(py::init<>()) - .def(py::init(), - py::arg("cnn_bilstm"), py::arg("bpe_vocab"), py::arg("num_threads") = 1, - py::arg("debug") = false, py::arg("provider") = "cpu") + .def(py::init(), + py::arg("cnn_bilstm"), py::arg("bpe_vocab"), + py::arg("num_threads") = 1, py::arg("debug") = false, + py::arg("provider") = "cpu") .def_readwrite("cnn_bilstm", &PyClass::cnn_bilstm) .def_readwrite("bpe_vocab", &PyClass::bpe_vocab) .def_readwrite("num_threads", &PyClass::num_threads) @@ -30,7 +34,8 @@ static void PybindOnlinePunctuationConfig(py::module *m) { py::class_(*m, "OnlinePunctuationConfig") .def(py::init<>()) - .def(py::init(), py::arg("model_config")) + .def(py::init(), + py::arg("model_config")) .def_readwrite("model_config", &PyClass::model) .def("validate", &PyClass::Validate) .def("__str__", &PyClass::ToString); @@ -43,8 +48,8 @@ void PybindOnlinePunctuation(py::module *m) { py::class_(*m, "OnlinePunctuation") .def(py::init(), py::arg("config"), py::call_guard()) - .def("add_punctuation_with_case", &PyClass::AddPunctuationWithCase, py::arg("text"), - py::call_guard()); + .def("add_punctuation_with_case", &PyClass::AddPunctuationWithCase, + py::arg("text"), py::call_guard()); } } // namespace sherpa_onnx