Add CreateOnlineStreamWithHotwords to C API (#323)
* add default visibility to SHERPA_ONNX_EXPORT * expose CreateOnlineStreamWithHotwords method via C API Co-authored-by: Nick Fisher <nick.fisher@polyvox.app>
This commit is contained in:
@@ -107,6 +107,13 @@ SherpaOnnxOnlineStream *CreateOnlineStream(
|
|||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SherpaOnnxOnlineStream *CreateOnlineStreamWithHotwords(
|
||||||
|
const SherpaOnnxOnlineRecognizer *recognizer, const char *hotwords) {
|
||||||
|
SherpaOnnxOnlineStream *stream =
|
||||||
|
new SherpaOnnxOnlineStream(recognizer->impl->CreateStream(hotwords));
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
void DestroyOnlineStream(SherpaOnnxOnlineStream *stream) { delete stream; }
|
void DestroyOnlineStream(SherpaOnnxOnlineStream *stream) { delete stream; }
|
||||||
|
|
||||||
void AcceptWaveform(SherpaOnnxOnlineStream *stream, int32_t sample_rate,
|
void AcceptWaveform(SherpaOnnxOnlineStream *stream, int32_t sample_rate,
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ extern "C" {
|
|||||||
#define SHERPA_ONNX_IMPORT
|
#define SHERPA_ONNX_IMPORT
|
||||||
#endif
|
#endif
|
||||||
#else // WIN32
|
#else // WIN32
|
||||||
#define SHERPA_ONNX_EXPORT
|
#define SHERPA_ONNX_EXPORT __attribute__((visibility("default")))
|
||||||
#define SHERPA_ONNX_IMPORT SHERPA_ONNX_EXPORT
|
#define SHERPA_ONNX_IMPORT SHERPA_ONNX_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -178,6 +178,13 @@ SHERPA_ONNX_API void DestroyOnlineRecognizer(
|
|||||||
SHERPA_ONNX_API SherpaOnnxOnlineStream *CreateOnlineStream(
|
SHERPA_ONNX_API SherpaOnnxOnlineStream *CreateOnlineStream(
|
||||||
const SherpaOnnxOnlineRecognizer *recognizer);
|
const SherpaOnnxOnlineRecognizer *recognizer);
|
||||||
|
|
||||||
|
/// Create an online stream for accepting wave samples with the specified hot words.
|
||||||
|
///
|
||||||
|
/// @param recognizer A pointer returned by CreateOnlineRecognizer()
|
||||||
|
/// @return Return a pointer to an OnlineStream. The user has to invoke
|
||||||
|
/// DestroyOnlineStream() to free it to avoid memory leak.
|
||||||
|
SHERPA_ONNX_API SherpaOnnxOnlineStream *CreateOnlineStreamWithHotwords(const SherpaOnnxOnlineRecognizer *recognizer, const char *hotwords);
|
||||||
|
|
||||||
/// Destroy an online stream.
|
/// Destroy an online stream.
|
||||||
///
|
///
|
||||||
/// @param stream A pointer returned by CreateOnlineStream()
|
/// @param stream A pointer returned by CreateOnlineStream()
|
||||||
|
|||||||
Reference in New Issue
Block a user