Committed by
GitHub
Add missing start_time to python API (#591)
Co-authored-by: vsd-vector <askars.salimbajevs@tilde.lv>
正在显示
2 个修改的文件
包含
6 行增加
和
0 行删除
| @@ -24,6 +24,9 @@ static void PybindOnlineRecognizerResult(py::module *m) { | @@ -24,6 +24,9 @@ static void PybindOnlineRecognizerResult(py::module *m) { | ||
| 24 | "tokens", | 24 | "tokens", |
| 25 | [](PyClass &self) -> std::vector<std::string> { return self.tokens; }) | 25 | [](PyClass &self) -> std::vector<std::string> { return self.tokens; }) |
| 26 | .def_property_readonly( | 26 | .def_property_readonly( |
| 27 | + "start_time", | ||
| 28 | + [](PyClass &self) -> float { return self.start_time; }) | ||
| 29 | + .def_property_readonly( | ||
| 27 | "timestamps", | 30 | "timestamps", |
| 28 | [](PyClass &self) -> std::vector<float> { return self.timestamps; }); | 31 | [](PyClass &self) -> std::vector<float> { return self.timestamps; }); |
| 29 | } | 32 | } |
| @@ -509,6 +509,9 @@ class OnlineRecognizer(object): | @@ -509,6 +509,9 @@ class OnlineRecognizer(object): | ||
| 509 | def timestamps(self, s: OnlineStream) -> List[float]: | 509 | def timestamps(self, s: OnlineStream) -> List[float]: |
| 510 | return self.recognizer.get_result(s).timestamps | 510 | return self.recognizer.get_result(s).timestamps |
| 511 | 511 | ||
| 512 | + def start_time(self, s: OnlineStream) -> float: | ||
| 513 | + return self.recognizer.get_result(s).start_time | ||
| 514 | + | ||
| 512 | def is_endpoint(self, s: OnlineStream) -> bool: | 515 | def is_endpoint(self, s: OnlineStream) -> bool: |
| 513 | return self.recognizer.is_endpoint(s) | 516 | return self.recognizer.is_endpoint(s) |
| 514 | 517 |
-
请 注册 或 登录 后发表评论