Skip to content

Commit

Permalink
Fix typos in .Net APIs (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored May 14, 2023
1 parent b8fbf8e commit 959f13e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(sherpa-onnx)

set(SHERPA_ONNX_VERSION "1.4.2")
set(SHERPA_ONNX_VERSION "1.4.3")

# Disable warning about
#
Expand Down
2 changes: 1 addition & 1 deletion c-api-examples/decode-file-c-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int32_t main(int32_t argc, char *argv[]) {
DestroyOnlineRecognizerResult(r);

DestroyDisplay(display);
DestoryOnlineStream(stream);
DestroyOnlineStream(stream);
DestroyOnlineRecognizer(recognizer);
fprintf(stderr, "\n");

Expand Down
2 changes: 1 addition & 1 deletion ffmpeg-examples/sherpa-onnx-ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ int main(int argc, char **argv) {
DestroyOnlineRecognizerResult(r);

DestroyDisplay(display);
DestoryOnlineStream(stream);
DestroyOnlineStream(stream);
DestroyOnlineRecognizer(recognizer);

avfilter_graph_free(&filter_graph);
Expand Down
4 changes: 2 additions & 2 deletions sherpa-onnx/c-api/c-api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ SherpaOnnxOnlineStream *CreateOnlineStream(
return stream;
}

void DestoryOnlineStream(SherpaOnnxOnlineStream *stream) { delete stream; }
void DestroyOnlineStream(SherpaOnnxOnlineStream *stream) { delete stream; }

void AcceptWaveform(SherpaOnnxOnlineStream *stream, int32_t sample_rate,
const float *samples, int32_t n) {
Expand Down Expand Up @@ -222,7 +222,7 @@ SherpaOnnxOfflineStream *CreateOfflineStream(
return stream;
}

void DestoryOfflineStream(SherpaOnnxOfflineStream *stream) { delete stream; }
void DestroyOfflineStream(SherpaOnnxOfflineStream *stream) { delete stream; }

void AcceptWaveformOffline(SherpaOnnxOfflineStream *stream, int32_t sample_rate,
const float *samples, int32_t n) {
Expand Down
8 changes: 4 additions & 4 deletions sherpa-onnx/c-api/c-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ SHERPA_ONNX_API void DestroyOnlineRecognizer(
///
/// @param recognizer A pointer returned by CreateOnlineRecognizer()
/// @return Return a pointer to an OnlineStream. The user has to invoke
/// DestoryOnlineStream() to free it to avoid memory leak.
/// DestroyOnlineStream() to free it to avoid memory leak.
SHERPA_ONNX_API SherpaOnnxOnlineStream *CreateOnlineStream(
const SherpaOnnxOnlineRecognizer *recognizer);

/// Destroy an online stream.
///
/// @param stream A pointer returned by CreateOnlineStream()
SHERPA_ONNX_API void DestoryOnlineStream(SherpaOnnxOnlineStream *stream);
SHERPA_ONNX_API void DestroyOnlineStream(SherpaOnnxOnlineStream *stream);

/// Accept input audio samples and compute the features.
/// The user has to invoke DecodeOnlineStream() to run the neural network and
Expand Down Expand Up @@ -303,14 +303,14 @@ SHERPA_ONNX_API void DestroyOfflineRecognizer(
///
/// @param recognizer A pointer returned by CreateOfflineRecognizer()
/// @return Return a pointer to an OfflineStream. The user has to invoke
/// DestoryOfflineStream() to free it to avoid memory leak.
/// DestroyOfflineStream() to free it to avoid memory leak.
SHERPA_ONNX_API SherpaOnnxOfflineStream *CreateOfflineStream(
const SherpaOnnxOfflineRecognizer *recognizer);

/// Destroy an offline stream.
///
/// @param stream A pointer returned by CreateOfflineStream()
SHERPA_ONNX_API void DestoryOfflineStream(SherpaOnnxOfflineStream *stream);
SHERPA_ONNX_API void DestroyOfflineStream(SherpaOnnxOfflineStream *stream);

/// Accept input audio samples and compute the features.
/// The user has to invoke DecodeOfflineStream() to run the neural network and
Expand Down
25 changes: 13 additions & 12 deletions swift-api-examples/SherpaOnnx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func sherpaOnnxOnlineTransducerModelConfig(
tokens: String,
numThreads: Int = 2,
debug: Int = 0
) -> SherpaOnnxOnlineTransducerModelConfig{
) -> SherpaOnnxOnlineTransducerModelConfig {
return SherpaOnnxOnlineTransducerModelConfig(
encoder: toCPointer(encoder),
decoder: toCPointer(decoder),
Expand All @@ -57,15 +57,15 @@ func sherpaOnnxFeatureConfig(
}

func sherpaOnnxOnlineRecognizerConfig(
featConfig: SherpaOnnxFeatureConfig,
modelConfig: SherpaOnnxOnlineTransducerModelConfig,
enableEndpoint: Bool = false,
rule1MinTrailingSilence: Float = 2.4,
rule2MinTrailingSilence: Float = 1.2,
rule3MinUtteranceLength: Float = 30,
decodingMethod: String = "greedy_search",
maxActivePaths: Int = 4
) -> SherpaOnnxOnlineRecognizerConfig{
featConfig: SherpaOnnxFeatureConfig,
modelConfig: SherpaOnnxOnlineTransducerModelConfig,
enableEndpoint: Bool = false,
rule1MinTrailingSilence: Float = 2.4,
rule2MinTrailingSilence: Float = 1.2,
rule3MinUtteranceLength: Float = 30,
decodingMethod: String = "greedy_search",
maxActivePaths: Int = 4
) -> SherpaOnnxOnlineRecognizerConfig {
return SherpaOnnxOnlineRecognizerConfig(
feat_config: featConfig,
model_config: modelConfig,
Expand Down Expand Up @@ -121,7 +121,7 @@ class SherpaOnnxRecognizer {

deinit {
if let stream {
DestoryOnlineStream(stream)
DestroyOnlineStream(stream)
}

if let recognizer {
Expand Down Expand Up @@ -152,7 +152,8 @@ class SherpaOnnxRecognizer {

/// Get the decoding results so far
func getResult() -> SherpaOnnxOnlineRecongitionResult {
let result: UnsafeMutablePointer<SherpaOnnxOnlineRecognizerResult>? = GetOnlineStreamResult(recognizer, stream)
let result: UnsafeMutablePointer<SherpaOnnxOnlineRecognizerResult>? = GetOnlineStreamResult(
recognizer, stream)
return SherpaOnnxOnlineRecongitionResult(result: result)
}

Expand Down

0 comments on commit 959f13e

Please sign in to comment.