Skip to content

Commit

Permalink
Wrap Reset() and IsEndpoint() to .Net (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Aug 4, 2023
1 parent 8a6614e commit 39d6b91
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 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-ncnn)

set(SHERPA_NCNN_VERSION "2.0.2")
set(SHERPA_NCNN_VERSION "2.0.4")

# Disable warning about
#
Expand Down
18 changes: 17 additions & 1 deletion scripts/dotnet/sherpa-ncnn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public struct OnlineRecognizerConfig
public TransducerModelConfig ModelConfig;
public TransducerDecoderConfig DecoderConfig;

public int EnableEndpoit;
public int EnableEndpoint;
public float Rule1MinTrailingSilence;
public float Rule2MinTrailingSilence;
public float Rule3MinUtteranceLength;
Expand Down Expand Up @@ -87,6 +87,16 @@ public bool IsReady(OnlineStream stream)
return IsReady(_handle.Handle, stream.Handle) != 0;
}

public bool IsEndpoint(OnlineStream stream)
{
return IsEndpoint(_handle.Handle, stream.Handle) != 0;
}

public void Reset(OnlineStream stream)
{
Reset(_handle.Handle, stream.Handle);
}

public void Decode(OnlineStream stream)
{
Decode(_handle.Handle, stream.Handle);
Expand Down Expand Up @@ -137,6 +147,12 @@ private void Cleanup()
[DllImport(dllName)]
private static extern int IsReady(IntPtr handle, IntPtr stream);

[DllImport(dllName)]
private static extern int IsEndpoint(IntPtr handle, IntPtr stream);

[DllImport(dllName)]
private static extern void Reset(IntPtr handle, IntPtr stream);

[DllImport(dllName, EntryPoint = "Decode")]
private static extern void Decode(IntPtr handle, IntPtr stream);

Expand Down

0 comments on commit 39d6b91

Please sign in to comment.