正在显示
2 个修改的文件
包含
17 行增加
和
0 行删除
| @@ -561,6 +561,13 @@ SherpaOnnxOnlineStream *CreateKeywordStream( | @@ -561,6 +561,13 @@ SherpaOnnxOnlineStream *CreateKeywordStream( | ||
| 561 | return stream; | 561 | return stream; |
| 562 | } | 562 | } |
| 563 | 563 | ||
| 564 | +SherpaOnnxOnlineStream *CreateKeywordStreamWithKeywords( | ||
| 565 | + const SherpaOnnxKeywordSpotter *spotter, const char *keywords) { | ||
| 566 | + SherpaOnnxOnlineStream *stream = | ||
| 567 | + new SherpaOnnxOnlineStream(spotter->impl->CreateStream(keywords)); | ||
| 568 | + return stream; | ||
| 569 | +} | ||
| 570 | + | ||
| 564 | int32_t IsKeywordStreamReady(SherpaOnnxKeywordSpotter *spotter, | 571 | int32_t IsKeywordStreamReady(SherpaOnnxKeywordSpotter *spotter, |
| 565 | SherpaOnnxOnlineStream *stream) { | 572 | SherpaOnnxOnlineStream *stream) { |
| 566 | return spotter->impl->IsReady(stream->impl.get()); | 573 | return spotter->impl->IsReady(stream->impl.get()); |
| @@ -583,6 +583,16 @@ SHERPA_ONNX_API void DestroyKeywordSpotter(SherpaOnnxKeywordSpotter *spotter); | @@ -583,6 +583,16 @@ SHERPA_ONNX_API void DestroyKeywordSpotter(SherpaOnnxKeywordSpotter *spotter); | ||
| 583 | SHERPA_ONNX_API SherpaOnnxOnlineStream *CreateKeywordStream( | 583 | SHERPA_ONNX_API SherpaOnnxOnlineStream *CreateKeywordStream( |
| 584 | const SherpaOnnxKeywordSpotter *spotter); | 584 | const SherpaOnnxKeywordSpotter *spotter); |
| 585 | 585 | ||
| 586 | +/// Create an online stream for accepting wave samples with the specified hot | ||
| 587 | +/// words. | ||
| 588 | +/// | ||
| 589 | +/// @param spotter A pointer returned by CreateKeywordSpotter() | ||
| 590 | +/// @param keywords A pointer points to the keywords that you set | ||
| 591 | +/// @return Return a pointer to an OnlineStream. The user has to invoke | ||
| 592 | +/// DestroyOnlineStream() to free it to avoid memory leak. | ||
| 593 | +SHERPA_ONNX_API SherpaOnnxOnlineStream *CreateKeywordStreamWithKeywords( | ||
| 594 | + const SherpaOnnxKeywordSpotter *spotter, const char *keywords); | ||
| 595 | + | ||
| 586 | /// Return 1 if there are enough number of feature frames for decoding. | 596 | /// Return 1 if there are enough number of feature frames for decoding. |
| 587 | /// Return 0 otherwise. | 597 | /// Return 0 otherwise. |
| 588 | /// | 598 | /// |
-
请 注册 或 登录 后发表评论