正在显示
31 个修改的文件
包含
263 行增加
和
55 行删除
| @@ -196,6 +196,7 @@ jobs: | @@ -196,6 +196,7 @@ jobs: | ||
| 196 | cp -v scripts/dotnet/examples/spoken-language-identification.csproj dotnet-examples/spoken-language-identification/ | 196 | cp -v scripts/dotnet/examples/spoken-language-identification.csproj dotnet-examples/spoken-language-identification/ |
| 197 | cp -v scripts/dotnet/examples/streaming-hlg-decoding.csproj dotnet-examples/streaming-hlg-decoding | 197 | cp -v scripts/dotnet/examples/streaming-hlg-decoding.csproj dotnet-examples/streaming-hlg-decoding |
| 198 | cp -v scripts/dotnet/examples/speaker-identification.csproj dotnet-examples/speaker-identification | 198 | cp -v scripts/dotnet/examples/speaker-identification.csproj dotnet-examples/speaker-identification |
| 199 | + cp -v scripts/dotnet/examples/offline-punctuation.csproj dotnet-examples/offline-punctuation | ||
| 199 | 200 | ||
| 200 | ls -lh /tmp | 201 | ls -lh /tmp |
| 201 | 202 |
| 1 | +// Copyright (c) 2024 Xiaomi Corporation | ||
| 2 | +// | ||
| 3 | +// This file shows how to add punctuations to text. | ||
| 4 | +// | ||
| 5 | +// 1. Download a model from | ||
| 6 | +// https://github.com/k2-fsa/sherpa-onnx/releases/tag/punctuation-models | ||
| 7 | +// | ||
| 8 | +// wget https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
| 9 | +// | ||
| 10 | +// 3. Now run it | ||
| 11 | +// | ||
| 12 | +// dotnet run | ||
| 13 | + | ||
| 14 | +using SherpaOnnx; | ||
| 15 | +using System.Collections.Generic; | ||
| 16 | +using System; | ||
| 17 | + | ||
| 18 | +class OfflinePunctuationDemo | ||
| 19 | +{ | ||
| 20 | + | ||
| 21 | + static void Main(string[] args) | ||
| 22 | + { | ||
| 23 | + var config = new OfflinePunctuationConfig(); | ||
| 24 | + config.Model.CtTransformer = "./sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12/model.onnx"; | ||
| 25 | + config.Model.Debug = 1; | ||
| 26 | + config.Model.NumThreads = 1; | ||
| 27 | + var punct = new OfflinePunctuation(config); | ||
| 28 | + | ||
| 29 | + string[] textList = new string[] { | ||
| 30 | + "这是一个测试你好吗How are you我很好thank you are you ok谢谢你", | ||
| 31 | + "我们都是木头人不会说话不会动", | ||
| 32 | + "The African blogosphere is rapidly expanding bringing more voices online in the form of commentaries opinions analyses rants and poetry", | ||
| 33 | + }; | ||
| 34 | + | ||
| 35 | + Console.WriteLine("---------"); | ||
| 36 | + foreach (string text in textList) | ||
| 37 | + { | ||
| 38 | + string textWithPunct = punct.AddPunct(text); | ||
| 39 | + Console.WriteLine("Input text: {0}", text); | ||
| 40 | + Console.WriteLine("Output text: {0}", textWithPunct); | ||
| 41 | + Console.WriteLine("---------"); | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | +} | ||
| 45 | + |
| 1 | +<Project Sdk="Microsoft.NET.Sdk"> | ||
| 2 | + | ||
| 3 | + <PropertyGroup> | ||
| 4 | + <OutputType>Exe</OutputType> | ||
| 5 | + <TargetFramework>net6.0</TargetFramework> | ||
| 6 | + <RootNamespace>offline_punctuation</RootNamespace> | ||
| 7 | + <ImplicitUsings>enable</ImplicitUsings> | ||
| 8 | + <Nullable>enable</Nullable> | ||
| 9 | + </PropertyGroup> | ||
| 10 | + | ||
| 11 | + <ItemGroup> | ||
| 12 | + <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | ||
| 13 | + </ItemGroup> | ||
| 14 | + | ||
| 15 | +</Project> |
dotnet-examples/offline-punctuation/run.sh
0 → 100755
| 1 | +#!/usr/bin/env bash | ||
| 2 | + | ||
| 3 | +set -ex | ||
| 4 | + | ||
| 5 | +if [ ! -e ./sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12/model.onnx ]; then | ||
| 6 | + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
| 7 | + tar xvf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
| 8 | + rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
| 9 | +fi | ||
| 10 | + | ||
| 11 | +dotnet run |
| @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "streaming-hlg-decoding", "s | @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "streaming-hlg-decoding", "s | ||
| 19 | EndProject | 19 | EndProject |
| 20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "speaker-identification", "speaker-identification\speaker-identification.csproj", "{2B1B140E-A92F-426B-B0DF-5D916B67304F}" | 20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "speaker-identification", "speaker-identification\speaker-identification.csproj", "{2B1B140E-A92F-426B-B0DF-5D916B67304F}" |
| 21 | EndProject | 21 | EndProject |
| 22 | +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "offline-punctuation", "offline-punctuation\offline-punctuation.csproj", "{42D85582-BB63-4259-A4EA-837D66AC078B}" | ||
| 23 | +EndProject | ||
| 22 | Global | 24 | Global |
| 23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | 25 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
| 24 | Debug|Any CPU = Debug|Any CPU | 26 | Debug|Any CPU = Debug|Any CPU |
| @@ -60,5 +62,9 @@ Global | @@ -60,5 +62,9 @@ Global | ||
| 60 | {2B1B140E-A92F-426B-B0DF-5D916B67304F}.Debug|Any CPU.Build.0 = Debug|Any CPU | 62 | {2B1B140E-A92F-426B-B0DF-5D916B67304F}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| 61 | {2B1B140E-A92F-426B-B0DF-5D916B67304F}.Release|Any CPU.ActiveCfg = Release|Any CPU | 63 | {2B1B140E-A92F-426B-B0DF-5D916B67304F}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| 62 | {2B1B140E-A92F-426B-B0DF-5D916B67304F}.Release|Any CPU.Build.0 = Release|Any CPU | 64 | {2B1B140E-A92F-426B-B0DF-5D916B67304F}.Release|Any CPU.Build.0 = Release|Any CPU |
| 65 | + {42D85582-BB63-4259-A4EA-837D66AC078B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 66 | + {42D85582-BB63-4259-A4EA-837D66AC078B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 67 | + {42D85582-BB63-4259-A4EA-837D66AC078B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 68 | + {42D85582-BB63-4259-A4EA-837D66AC078B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 63 | EndGlobalSection | 69 | EndGlobalSection |
| 64 | EndGlobal | 70 | EndGlobal |
| @@ -8,7 +8,6 @@ using System; | @@ -8,7 +8,6 @@ using System; | ||
| 8 | 8 | ||
| 9 | namespace SherpaOnnx | 9 | namespace SherpaOnnx |
| 10 | { | 10 | { |
| 11 | - | ||
| 12 | [StructLayout(LayoutKind.Sequential)] | 11 | [StructLayout(LayoutKind.Sequential)] |
| 13 | public struct OfflineLMConfig | 12 | public struct OfflineLMConfig |
| 14 | { | 13 | { |
| @@ -22,5 +21,4 @@ namespace SherpaOnnx | @@ -22,5 +21,4 @@ namespace SherpaOnnx | ||
| 22 | 21 | ||
| 23 | public float Scale; | 22 | public float Scale; |
| 24 | } | 23 | } |
| 25 | - | ||
| 26 | -} | ||
| 24 | +} |
| @@ -8,7 +8,6 @@ using System; | @@ -8,7 +8,6 @@ using System; | ||
| 8 | 8 | ||
| 9 | namespace SherpaOnnx | 9 | namespace SherpaOnnx |
| 10 | { | 10 | { |
| 11 | - | ||
| 12 | [StructLayout(LayoutKind.Sequential)] | 11 | [StructLayout(LayoutKind.Sequential)] |
| 13 | public struct OfflineModelConfig | 12 | public struct OfflineModelConfig |
| 14 | { | 13 | { |
| @@ -44,6 +43,4 @@ namespace SherpaOnnx | @@ -44,6 +43,4 @@ namespace SherpaOnnx | ||
| 44 | [MarshalAs(UnmanagedType.LPStr)] | 43 | [MarshalAs(UnmanagedType.LPStr)] |
| 45 | public string ModelType; | 44 | public string ModelType; |
| 46 | } | 45 | } |
| 47 | - | ||
| 48 | - | ||
| 49 | -} | ||
| 46 | +} |
| @@ -8,7 +8,6 @@ using System; | @@ -8,7 +8,6 @@ using System; | ||
| 8 | 8 | ||
| 9 | namespace SherpaOnnx | 9 | namespace SherpaOnnx |
| 10 | { | 10 | { |
| 11 | - | ||
| 12 | [StructLayout(LayoutKind.Sequential)] | 11 | [StructLayout(LayoutKind.Sequential)] |
| 13 | public struct OfflineNemoEncDecCtcModelConfig | 12 | public struct OfflineNemoEncDecCtcModelConfig |
| 14 | { | 13 | { |
| @@ -19,4 +18,4 @@ namespace SherpaOnnx | @@ -19,4 +18,4 @@ namespace SherpaOnnx | ||
| 19 | [MarshalAs(UnmanagedType.LPStr)] | 18 | [MarshalAs(UnmanagedType.LPStr)] |
| 20 | public string Model; | 19 | public string Model; |
| 21 | } | 20 | } |
| 22 | -} | ||
| 21 | +} |
scripts/dotnet/OfflinePunctuation.cs
0 → 100644
| 1 | +/// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) | ||
| 2 | + | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Collections.Generic; | ||
| 5 | +using System.Runtime.InteropServices; | ||
| 6 | +using System.Text; | ||
| 7 | +using System; | ||
| 8 | + | ||
| 9 | +namespace SherpaOnnx | ||
| 10 | +{ | ||
| 11 | + public class OfflinePunctuation : IDisposable | ||
| 12 | + { | ||
| 13 | + public OfflinePunctuation(OfflinePunctuationConfig config) | ||
| 14 | + { | ||
| 15 | + IntPtr h = SherpaOnnxCreateOfflinePunctuation(ref config); | ||
| 16 | + _handle = new HandleRef(this, h); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public String AddPunct(String text) | ||
| 20 | + { | ||
| 21 | + IntPtr p = SherpaOfflinePunctuationAddPunct(_handle.Handle, text); | ||
| 22 | + | ||
| 23 | + string s = ""; | ||
| 24 | + int length = 0; | ||
| 25 | + | ||
| 26 | + unsafe | ||
| 27 | + { | ||
| 28 | + byte* b = (byte*)p; | ||
| 29 | + if (b != null) | ||
| 30 | + { | ||
| 31 | + while (*b != 0) | ||
| 32 | + { | ||
| 33 | + ++b; | ||
| 34 | + length += 1; | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + if (length > 0) | ||
| 40 | + { | ||
| 41 | + byte[] stringBuffer = new byte[length]; | ||
| 42 | + Marshal.Copy(p, stringBuffer, 0, length); | ||
| 43 | + s = Encoding.UTF8.GetString(stringBuffer); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + SherpaOfflinePunctuationFreeText(p); | ||
| 47 | + | ||
| 48 | + return s; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public void Dispose() | ||
| 52 | + { | ||
| 53 | + Cleanup(); | ||
| 54 | + // Prevent the object from being placed on the | ||
| 55 | + // finalization queue | ||
| 56 | + System.GC.SuppressFinalize(this); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + ~OfflinePunctuation() | ||
| 60 | + { | ||
| 61 | + Cleanup(); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + private void Cleanup() | ||
| 65 | + { | ||
| 66 | + SherpaOnnxDestroyOfflinePunctuation(_handle.Handle); | ||
| 67 | + | ||
| 68 | + // Don't permit the handle to be used again. | ||
| 69 | + _handle = new HandleRef(this, IntPtr.Zero); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + private HandleRef _handle; | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + [DllImport(Dll.Filename)] | ||
| 76 | + private static extern IntPtr SherpaOnnxCreateOfflinePunctuation(ref OfflinePunctuationConfig config); | ||
| 77 | + | ||
| 78 | + [DllImport(Dll.Filename)] | ||
| 79 | + private static extern void SherpaOnnxDestroyOfflinePunctuation(IntPtr handle); | ||
| 80 | + | ||
| 81 | + [DllImport(Dll.Filename)] | ||
| 82 | + private static extern IntPtr SherpaOfflinePunctuationAddPunct(IntPtr handle, [MarshalAs(UnmanagedType.LPStr)] string text); | ||
| 83 | + | ||
| 84 | + [DllImport(Dll.Filename)] | ||
| 85 | + private static extern void SherpaOfflinePunctuationFreeText(IntPtr p); | ||
| 86 | + } | ||
| 87 | +} | ||
| 88 | + |
scripts/dotnet/OfflinePunctuationConfig.cs
0 → 100644
| 1 | +/// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) | ||
| 2 | + | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Collections.Generic; | ||
| 5 | +using System.Runtime.InteropServices; | ||
| 6 | +using System.Text; | ||
| 7 | +using System; | ||
| 8 | + | ||
| 9 | +namespace SherpaOnnx | ||
| 10 | +{ | ||
| 11 | + [StructLayout(LayoutKind.Sequential)] | ||
| 12 | + public struct OfflinePunctuationConfig | ||
| 13 | + { | ||
| 14 | + public OfflinePunctuationConfig() | ||
| 15 | + { | ||
| 16 | + Model = new OfflinePunctuationModelConfig(); | ||
| 17 | + } | ||
| 18 | + public OfflinePunctuationModelConfig Model; | ||
| 19 | + } | ||
| 20 | +} | ||
| 21 | + |
| 1 | +/// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) | ||
| 2 | + | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Collections.Generic; | ||
| 5 | +using System.Runtime.InteropServices; | ||
| 6 | +using System.Text; | ||
| 7 | +using System; | ||
| 8 | + | ||
| 9 | +namespace SherpaOnnx | ||
| 10 | +{ | ||
| 11 | + [StructLayout(LayoutKind.Sequential)] | ||
| 12 | + public struct OfflinePunctuationModelConfig | ||
| 13 | + { | ||
| 14 | + public OfflinePunctuationModelConfig() | ||
| 15 | + { | ||
| 16 | + CtTransformer = ""; | ||
| 17 | + NumThreads = 1; | ||
| 18 | + Debug = 0; | ||
| 19 | + Provider = "cpu"; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + [MarshalAs(UnmanagedType.LPStr)] | ||
| 23 | + public string CtTransformer; | ||
| 24 | + | ||
| 25 | + public int NumThreads; | ||
| 26 | + | ||
| 27 | + public int Debug; | ||
| 28 | + | ||
| 29 | + [MarshalAs(UnmanagedType.LPStr)] | ||
| 30 | + public string Provider; | ||
| 31 | + } | ||
| 32 | +} |
| @@ -72,5 +72,4 @@ namespace SherpaOnnx | @@ -72,5 +72,4 @@ namespace SherpaOnnx | ||
| 72 | [DllImport(Dll.Filename, EntryPoint = "DecodeMultipleOfflineStreams")] | 72 | [DllImport(Dll.Filename, EntryPoint = "DecodeMultipleOfflineStreams")] |
| 73 | private static extern void Decode(IntPtr handle, IntPtr[] streams, int n); | 73 | private static extern void Decode(IntPtr handle, IntPtr[] streams, int n); |
| 74 | } | 74 | } |
| 75 | - | ||
| 76 | -} | ||
| 75 | +} |
| @@ -8,7 +8,6 @@ using System; | @@ -8,7 +8,6 @@ using System; | ||
| 8 | 8 | ||
| 9 | namespace SherpaOnnx | 9 | namespace SherpaOnnx |
| 10 | { | 10 | { |
| 11 | - | ||
| 12 | [StructLayout(LayoutKind.Sequential)] | 11 | [StructLayout(LayoutKind.Sequential)] |
| 13 | public struct OfflineRecognizerConfig | 12 | public struct OfflineRecognizerConfig |
| 14 | { | 13 | { |
| @@ -38,6 +37,4 @@ namespace SherpaOnnx | @@ -38,6 +37,4 @@ namespace SherpaOnnx | ||
| 38 | 37 | ||
| 39 | public float HotwordsScore; | 38 | public float HotwordsScore; |
| 40 | } | 39 | } |
| 41 | - | ||
| 42 | - | ||
| 43 | -} | ||
| 40 | +} |
| @@ -8,7 +8,6 @@ using System; | @@ -8,7 +8,6 @@ using System; | ||
| 8 | 8 | ||
| 9 | namespace SherpaOnnx | 9 | namespace SherpaOnnx |
| 10 | { | 10 | { |
| 11 | - | ||
| 12 | public class OfflineRecognizerResult | 11 | public class OfflineRecognizerResult |
| 13 | { | 12 | { |
| 14 | public OfflineRecognizerResult(IntPtr handle) | 13 | public OfflineRecognizerResult(IntPtr handle) |
| @@ -44,6 +43,4 @@ namespace SherpaOnnx | @@ -44,6 +43,4 @@ namespace SherpaOnnx | ||
| 44 | private String _text; | 43 | private String _text; |
| 45 | public String Text => _text; | 44 | public String Text => _text; |
| 46 | } | 45 | } |
| 47 | - | ||
| 48 | - | ||
| 49 | -} | ||
| 46 | +} |
| @@ -8,7 +8,6 @@ using System; | @@ -8,7 +8,6 @@ using System; | ||
| 8 | 8 | ||
| 9 | namespace SherpaOnnx | 9 | namespace SherpaOnnx |
| 10 | { | 10 | { |
| 11 | - | ||
| 12 | public class OfflineStream : IDisposable | 11 | public class OfflineStream : IDisposable |
| 13 | { | 12 | { |
| 14 | public OfflineStream(IntPtr p) | 13 | public OfflineStream(IntPtr p) |
| @@ -68,5 +67,4 @@ namespace SherpaOnnx | @@ -68,5 +67,4 @@ namespace SherpaOnnx | ||
| 68 | [DllImport(Dll.Filename, EntryPoint = "DestroyOfflineRecognizerResult")] | 67 | [DllImport(Dll.Filename, EntryPoint = "DestroyOfflineRecognizerResult")] |
| 69 | private static extern void DestroyResult(IntPtr handle); | 68 | private static extern void DestroyResult(IntPtr handle); |
| 70 | } | 69 | } |
| 71 | - | ||
| 72 | -} | ||
| 70 | +} |
| @@ -8,7 +8,6 @@ using System; | @@ -8,7 +8,6 @@ using System; | ||
| 8 | 8 | ||
| 9 | namespace SherpaOnnx | 9 | namespace SherpaOnnx |
| 10 | { | 10 | { |
| 11 | - | ||
| 12 | [StructLayout(LayoutKind.Sequential)] | 11 | [StructLayout(LayoutKind.Sequential)] |
| 13 | public struct OfflineTtsModelConfig | 12 | public struct OfflineTtsModelConfig |
| 14 | { | 13 | { |
| @@ -26,4 +25,4 @@ namespace SherpaOnnx | @@ -26,4 +25,4 @@ namespace SherpaOnnx | ||
| 26 | [MarshalAs(UnmanagedType.LPStr)] | 25 | [MarshalAs(UnmanagedType.LPStr)] |
| 27 | public string Provider; | 26 | public string Provider; |
| 28 | } | 27 | } |
| 29 | -} | ||
| 28 | +} |
| @@ -10,7 +10,6 @@ using System; | @@ -10,7 +10,6 @@ using System; | ||
| 10 | 10 | ||
| 11 | namespace SherpaOnnx | 11 | namespace SherpaOnnx |
| 12 | { | 12 | { |
| 13 | - | ||
| 14 | [StructLayout(LayoutKind.Sequential)] | 13 | [StructLayout(LayoutKind.Sequential)] |
| 15 | public struct OnlineModelConfig | 14 | public struct OnlineModelConfig |
| 16 | { | 15 | { |
| @@ -45,5 +44,4 @@ namespace SherpaOnnx | @@ -45,5 +44,4 @@ namespace SherpaOnnx | ||
| 45 | [MarshalAs(UnmanagedType.LPStr)] | 44 | [MarshalAs(UnmanagedType.LPStr)] |
| 46 | public string ModelType; | 45 | public string ModelType; |
| 47 | } | 46 | } |
| 48 | - | ||
| 49 | -} | ||
| 47 | +} |
| @@ -10,7 +10,6 @@ using System; | @@ -10,7 +10,6 @@ using System; | ||
| 10 | 10 | ||
| 11 | namespace SherpaOnnx | 11 | namespace SherpaOnnx |
| 12 | { | 12 | { |
| 13 | - | ||
| 14 | [StructLayout(LayoutKind.Sequential)] | 13 | [StructLayout(LayoutKind.Sequential)] |
| 15 | public struct OnlineParaformerModelConfig | 14 | public struct OnlineParaformerModelConfig |
| 16 | { | 15 | { |
| @@ -26,5 +25,4 @@ namespace SherpaOnnx | @@ -26,5 +25,4 @@ namespace SherpaOnnx | ||
| 26 | [MarshalAs(UnmanagedType.LPStr)] | 25 | [MarshalAs(UnmanagedType.LPStr)] |
| 27 | public string Decoder; | 26 | public string Decoder; |
| 28 | } | 27 | } |
| 29 | - | ||
| 30 | -} | ||
| 28 | +} |
| @@ -10,7 +10,6 @@ using System; | @@ -10,7 +10,6 @@ using System; | ||
| 10 | 10 | ||
| 11 | namespace SherpaOnnx | 11 | namespace SherpaOnnx |
| 12 | { | 12 | { |
| 13 | - | ||
| 14 | [StructLayout(LayoutKind.Sequential)] | 13 | [StructLayout(LayoutKind.Sequential)] |
| 15 | public struct OnlineRecognizerConfig | 14 | public struct OnlineRecognizerConfig |
| 16 | { | 15 | { |
| @@ -66,5 +65,4 @@ namespace SherpaOnnx | @@ -66,5 +65,4 @@ namespace SherpaOnnx | ||
| 66 | 65 | ||
| 67 | public OnlineCtcFstDecoderConfig CtcFstDecoderConfig; | 66 | public OnlineCtcFstDecoderConfig CtcFstDecoderConfig; |
| 68 | } | 67 | } |
| 69 | - | ||
| 70 | -} | ||
| 68 | +} |
| @@ -10,7 +10,6 @@ using System; | @@ -10,7 +10,6 @@ using System; | ||
| 10 | 10 | ||
| 11 | namespace SherpaOnnx | 11 | namespace SherpaOnnx |
| 12 | { | 12 | { |
| 13 | - | ||
| 14 | public class OnlineRecognizerResult | 13 | public class OnlineRecognizerResult |
| 15 | { | 14 | { |
| 16 | public OnlineRecognizerResult(IntPtr handle) | 15 | public OnlineRecognizerResult(IntPtr handle) |
| @@ -103,4 +102,4 @@ namespace SherpaOnnx | @@ -103,4 +102,4 @@ namespace SherpaOnnx | ||
| 103 | private float[] _timestamps; | 102 | private float[] _timestamps; |
| 104 | public float[] Timestamps => _timestamps; | 103 | public float[] Timestamps => _timestamps; |
| 105 | } | 104 | } |
| 106 | -} | ||
| 105 | +} |
| @@ -10,7 +10,6 @@ using System; | @@ -10,7 +10,6 @@ using System; | ||
| 10 | 10 | ||
| 11 | namespace SherpaOnnx | 11 | namespace SherpaOnnx |
| 12 | { | 12 | { |
| 13 | - | ||
| 14 | public class OnlineStream : IDisposable | 13 | public class OnlineStream : IDisposable |
| 15 | { | 14 | { |
| 16 | public OnlineStream(IntPtr p) | 15 | public OnlineStream(IntPtr p) |
| @@ -61,5 +60,4 @@ namespace SherpaOnnx | @@ -61,5 +60,4 @@ namespace SherpaOnnx | ||
| 61 | [DllImport(Dll.Filename)] | 60 | [DllImport(Dll.Filename)] |
| 62 | private static extern void InputFinished(IntPtr handle); | 61 | private static extern void InputFinished(IntPtr handle); |
| 63 | } | 62 | } |
| 64 | - | ||
| 65 | -} | ||
| 63 | +} |
| @@ -10,7 +10,6 @@ using System; | @@ -10,7 +10,6 @@ using System; | ||
| 10 | 10 | ||
| 11 | namespace SherpaOnnx | 11 | namespace SherpaOnnx |
| 12 | { | 12 | { |
| 13 | - | ||
| 14 | [StructLayout(LayoutKind.Sequential)] | 13 | [StructLayout(LayoutKind.Sequential)] |
| 15 | public struct OnlineTransducerModelConfig | 14 | public struct OnlineTransducerModelConfig |
| 16 | { | 15 | { |
| @@ -30,5 +29,4 @@ namespace SherpaOnnx | @@ -30,5 +29,4 @@ namespace SherpaOnnx | ||
| 30 | [MarshalAs(UnmanagedType.LPStr)] | 29 | [MarshalAs(UnmanagedType.LPStr)] |
| 31 | public string Joiner; | 30 | public string Joiner; |
| 32 | } | 31 | } |
| 33 | - | ||
| 34 | -} | ||
| 32 | +} |
| 1 | +<Project Sdk="Microsoft.NET.Sdk"> | ||
| 2 | + | ||
| 3 | + <PropertyGroup> | ||
| 4 | + <OutputType>Exe</OutputType> | ||
| 5 | + <TargetFramework>net6.0</TargetFramework> | ||
| 6 | + <RootNamespace>offline_punctuation</RootNamespace> | ||
| 7 | + <ImplicitUsings>enable</ImplicitUsings> | ||
| 8 | + <Nullable>enable</Nullable> | ||
| 9 | + </PropertyGroup> | ||
| 10 | + | ||
| 11 | + <PropertyGroup> | ||
| 12 | + <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | ||
| 13 | + </PropertyGroup> | ||
| 14 | + | ||
| 15 | + <ItemGroup> | ||
| 16 | + <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | ||
| 17 | + </ItemGroup> | ||
| 18 | + | ||
| 19 | +</Project> |
-
请 注册 或 登录 后发表评论