Committed by
GitHub
Refactor .Net example project (#1049)
Co-authored-by: 东风破 <birdfishs@163.com>
正在显示
77 个修改的文件
包含
525 行增加
和
650 行删除
| @@ -134,6 +134,7 @@ jobs: | @@ -134,6 +134,7 @@ jobs: | ||
| 134 | - name: Copy files | 134 | - name: Copy files |
| 135 | shell: bash | 135 | shell: bash |
| 136 | run: | | 136 | run: | |
| 137 | + cp -v scripts/dotnet/examples/Common.csproj dotnet-examples/Common/ | ||
| 137 | cp -v scripts/dotnet/examples/offline-tts.csproj dotnet-examples/offline-tts/ | 138 | cp -v scripts/dotnet/examples/offline-tts.csproj dotnet-examples/offline-tts/ |
| 138 | cp -v scripts/dotnet/examples/offline-decode-files.csproj dotnet-examples/offline-decode-files/ | 139 | cp -v scripts/dotnet/examples/offline-decode-files.csproj dotnet-examples/offline-decode-files/ |
| 139 | cp -v scripts/dotnet/examples/online-decode-files.csproj dotnet-examples/online-decode-files/ | 140 | cp -v scripts/dotnet/examples/online-decode-files.csproj dotnet-examples/online-decode-files/ |
dotnet-examples/Common/Common.csproj
0 → 100644
| 1 | +<Project Sdk="Microsoft.NET.Sdk"> | ||
| 2 | + | ||
| 3 | + <PropertyGroup> | ||
| 4 | + <TargetFramework>net6.0</TargetFramework> | ||
| 5 | + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| 6 | + <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | ||
| 7 | + </PropertyGroup> | ||
| 8 | + <ItemGroup> | ||
| 9 | + <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 10 | + <PackageReference Include="org.k2fsa.sherpa.onnx" Version="1.10.1" /> | ||
| 11 | + </ItemGroup> | ||
| 12 | + | ||
| 13 | +</Project> |
| 1 | -// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang) | ||
| 2 | -using System; | ||
| 3 | -using System.IO; | ||
| 4 | - | ||
| 5 | -using System.Runtime.InteropServices; | ||
| 6 | - | ||
| 7 | -namespace SherpaOnnx | ||
| 8 | -{ | ||
| 9 | - | ||
| 10 | - [StructLayout(LayoutKind.Sequential)] | ||
| 11 | - public struct WaveHeader | ||
| 12 | - { | ||
| 13 | - public Int32 ChunkID; | ||
| 14 | - public Int32 ChunkSize; | ||
| 15 | - public Int32 Format; | ||
| 16 | - public Int32 SubChunk1ID; | ||
| 17 | - public Int32 SubChunk1Size; | ||
| 18 | - public Int16 AudioFormat; | ||
| 19 | - public Int16 NumChannels; | ||
| 20 | - public Int32 SampleRate; | ||
| 21 | - public Int32 ByteRate; | ||
| 22 | - public Int16 BlockAlign; | ||
| 23 | - public Int16 BitsPerSample; | ||
| 24 | - public Int32 SubChunk2ID; | ||
| 25 | - public Int32 SubChunk2Size; | ||
| 26 | - | ||
| 27 | - public bool Validate() | ||
| 28 | - { | ||
| 29 | - if (ChunkID != 0x46464952) | ||
| 30 | - { | ||
| 31 | - Console.WriteLine($"Invalid chunk ID: 0x{ChunkID:X}. Expect 0x46464952"); | ||
| 32 | - return false; | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - // E V A W | ||
| 36 | - if (Format != 0x45564157) | ||
| 37 | - { | ||
| 38 | - Console.WriteLine($"Invalid format: 0x{Format:X}. Expect 0x45564157"); | ||
| 39 | - return false; | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - // t m f | ||
| 43 | - if (SubChunk1ID != 0x20746d66) | ||
| 44 | - { | ||
| 45 | - Console.WriteLine($"Invalid SubChunk1ID: 0x{SubChunk1ID:X}. Expect 0x20746d66"); | ||
| 46 | - return false; | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - if (SubChunk1Size != 16) | ||
| 50 | - { | ||
| 51 | - Console.WriteLine($"Invalid SubChunk1Size: {SubChunk1Size}. Expect 16"); | ||
| 52 | - return false; | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - if (AudioFormat != 1) | ||
| 56 | - { | ||
| 57 | - Console.WriteLine($"Invalid AudioFormat: {AudioFormat}. Expect 1"); | ||
| 58 | - return false; | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - if (NumChannels != 1) | ||
| 62 | - { | ||
| 63 | - Console.WriteLine($"Invalid NumChannels: {NumChannels}. Expect 1"); | ||
| 64 | - return false; | ||
| 65 | - } | ||
| 66 | - | ||
| 67 | - if (ByteRate != (SampleRate * NumChannels * BitsPerSample / 8)) | ||
| 68 | - { | ||
| 69 | - Console.WriteLine($"Invalid byte rate: {ByteRate}."); | ||
| 70 | - return false; | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - if (BlockAlign != (NumChannels * BitsPerSample / 8)) | ||
| 74 | - { | ||
| 75 | - Console.WriteLine($"Invalid block align: {ByteRate}."); | ||
| 76 | - return false; | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - if (BitsPerSample != 16) | ||
| 80 | - { // we support only 16 bits per sample | ||
| 81 | - Console.WriteLine($"Invalid bits per sample: {BitsPerSample}. Expect 16"); | ||
| 82 | - return false; | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - return true; | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - // It supports only 16-bit, single channel WAVE format. | ||
| 90 | - // The sample rate can be any value. | ||
| 91 | - public class WaveReader | ||
| 92 | - { | ||
| 93 | - public WaveReader(String fileName) | ||
| 94 | - { | ||
| 95 | - if (!File.Exists(fileName)) | ||
| 96 | - { | ||
| 97 | - throw new ApplicationException($"{fileName} does not exist!"); | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - using (var stream = File.Open(fileName, FileMode.Open)) | ||
| 101 | - { | ||
| 102 | - using (var reader = new BinaryReader(stream)) | ||
| 103 | - { | ||
| 104 | - _header = ReadHeader(reader); | ||
| 105 | - | ||
| 106 | - if (!_header.Validate()) | ||
| 107 | - { | ||
| 108 | - throw new ApplicationException($"Invalid wave file ${fileName}"); | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - SkipMetaData(reader); | ||
| 112 | - | ||
| 113 | - // now read samples | ||
| 114 | - // _header.SubChunk2Size contains number of bytes in total. | ||
| 115 | - // we assume each sample is of type int16 | ||
| 116 | - byte[] buffer = reader.ReadBytes(_header.SubChunk2Size); | ||
| 117 | - short[] samples_int16 = new short[_header.SubChunk2Size / 2]; | ||
| 118 | - Buffer.BlockCopy(buffer, 0, samples_int16, 0, buffer.Length); | ||
| 119 | - | ||
| 120 | - _samples = new float[samples_int16.Length]; | ||
| 121 | - | ||
| 122 | - for (var i = 0; i < samples_int16.Length; ++i) | ||
| 123 | - { | ||
| 124 | - _samples[i] = samples_int16[i] / 32768.0F; | ||
| 125 | - } | ||
| 126 | - } | ||
| 127 | - } | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - private static WaveHeader ReadHeader(BinaryReader reader) | ||
| 131 | - { | ||
| 132 | - byte[] bytes = reader.ReadBytes(Marshal.SizeOf(typeof(WaveHeader))); | ||
| 133 | - | ||
| 134 | - GCHandle handle = GCHandle.Alloc(bytes, GCHandleType.Pinned); | ||
| 135 | - WaveHeader header = (WaveHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(WaveHeader))!; | ||
| 136 | - handle.Free(); | ||
| 137 | - | ||
| 138 | - return header; | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - private void SkipMetaData(BinaryReader reader) | ||
| 142 | - { | ||
| 143 | - var bs = reader.BaseStream; | ||
| 144 | - | ||
| 145 | - Int32 subChunk2ID = _header.SubChunk2ID; | ||
| 146 | - Int32 subChunk2Size = _header.SubChunk2Size; | ||
| 147 | - | ||
| 148 | - while (bs.Position != bs.Length && subChunk2ID != 0x61746164) | ||
| 149 | - { | ||
| 150 | - bs.Seek(subChunk2Size, SeekOrigin.Current); | ||
| 151 | - subChunk2ID = reader.ReadInt32(); | ||
| 152 | - subChunk2Size = reader.ReadInt32(); | ||
| 153 | - } | ||
| 154 | - _header.SubChunk2ID = subChunk2ID; | ||
| 155 | - _header.SubChunk2Size = subChunk2Size; | ||
| 156 | - } | ||
| 157 | - | ||
| 158 | - private WaveHeader _header; | ||
| 159 | - | ||
| 160 | - // Samples are normalized to the range [-1, 1] | ||
| 161 | - private float[] _samples; | ||
| 162 | - | ||
| 163 | - public int SampleRate => _header.SampleRate; | ||
| 164 | - public float[] Samples => _samples; | ||
| 165 | - | ||
| 166 | - public static void Test(String fileName) | ||
| 167 | - { | ||
| 168 | - WaveReader reader = new WaveReader(fileName); | ||
| 169 | - Console.WriteLine($"samples length: {reader.Samples.Length}"); | ||
| 170 | - Console.WriteLine($"samples rate: {reader.SampleRate}"); | ||
| 171 | - } | ||
| 172 | - } | ||
| 173 | - | ||
| 174 | -} | 1 | +// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang) |
| 2 | +using System; | ||
| 3 | +using System.IO; | ||
| 4 | + | ||
| 5 | +using System.Runtime.InteropServices; | ||
| 6 | + | ||
| 7 | +namespace SherpaOnnx | ||
| 8 | +{ | ||
| 9 | + | ||
| 10 | + [StructLayout(LayoutKind.Sequential)] | ||
| 11 | + public struct WaveHeader | ||
| 12 | + { | ||
| 13 | + public Int32 ChunkID; | ||
| 14 | + public Int32 ChunkSize; | ||
| 15 | + public Int32 Format; | ||
| 16 | + public Int32 SubChunk1ID; | ||
| 17 | + public Int32 SubChunk1Size; | ||
| 18 | + public Int16 AudioFormat; | ||
| 19 | + public Int16 NumChannels; | ||
| 20 | + public Int32 SampleRate; | ||
| 21 | + public Int32 ByteRate; | ||
| 22 | + public Int16 BlockAlign; | ||
| 23 | + public Int16 BitsPerSample; | ||
| 24 | + public Int32 SubChunk2ID; | ||
| 25 | + public Int32 SubChunk2Size; | ||
| 26 | + | ||
| 27 | + public bool Validate() | ||
| 28 | + { | ||
| 29 | + if (ChunkID != 0x46464952) | ||
| 30 | + { | ||
| 31 | + Console.WriteLine($"Invalid chunk ID: 0x{ChunkID:X}. Expect 0x46464952"); | ||
| 32 | + return false; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + // E V A W | ||
| 36 | + if (Format != 0x45564157) | ||
| 37 | + { | ||
| 38 | + Console.WriteLine($"Invalid format: 0x{Format:X}. Expect 0x45564157"); | ||
| 39 | + return false; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + // t m f | ||
| 43 | + if (SubChunk1ID != 0x20746d66) | ||
| 44 | + { | ||
| 45 | + Console.WriteLine($"Invalid SubChunk1ID: 0x{SubChunk1ID:X}. Expect 0x20746d66"); | ||
| 46 | + return false; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + if (SubChunk1Size != 16) | ||
| 50 | + { | ||
| 51 | + Console.WriteLine($"Invalid SubChunk1Size: {SubChunk1Size}. Expect 16"); | ||
| 52 | + return false; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + if (AudioFormat != 1) | ||
| 56 | + { | ||
| 57 | + Console.WriteLine($"Invalid AudioFormat: {AudioFormat}. Expect 1"); | ||
| 58 | + return false; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + if (NumChannels != 1) | ||
| 62 | + { | ||
| 63 | + Console.WriteLine($"Invalid NumChannels: {NumChannels}. Expect 1"); | ||
| 64 | + return false; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + if (ByteRate != (SampleRate * NumChannels * BitsPerSample / 8)) | ||
| 68 | + { | ||
| 69 | + Console.WriteLine($"Invalid byte rate: {ByteRate}."); | ||
| 70 | + return false; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + if (BlockAlign != (NumChannels * BitsPerSample / 8)) | ||
| 74 | + { | ||
| 75 | + Console.WriteLine($"Invalid block align: {ByteRate}."); | ||
| 76 | + return false; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + if (BitsPerSample != 16) | ||
| 80 | + { // we support only 16 bits per sample | ||
| 81 | + Console.WriteLine($"Invalid bits per sample: {BitsPerSample}. Expect 16"); | ||
| 82 | + return false; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + return true; | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + // It supports only 16-bit, single channel WAVE format. | ||
| 90 | + // The sample rate can be any value. | ||
| 91 | + public class WaveReader | ||
| 92 | + { | ||
| 93 | + public WaveReader(String fileName) | ||
| 94 | + { | ||
| 95 | + if (!File.Exists(fileName)) | ||
| 96 | + { | ||
| 97 | + throw new ApplicationException($"{fileName} does not exist!"); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + using (var stream = File.Open(fileName, FileMode.Open)) | ||
| 101 | + { | ||
| 102 | + using (var reader = new BinaryReader(stream)) | ||
| 103 | + { | ||
| 104 | + _header = ReadHeader(reader); | ||
| 105 | + | ||
| 106 | + if (!_header.Validate()) | ||
| 107 | + { | ||
| 108 | + throw new ApplicationException($"Invalid wave file ${fileName}"); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + SkipMetaData(reader); | ||
| 112 | + | ||
| 113 | + // now read samples | ||
| 114 | + // _header.SubChunk2Size contains number of bytes in total. | ||
| 115 | + // we assume each sample is of type int16 | ||
| 116 | + byte[] buffer = reader.ReadBytes(_header.SubChunk2Size); | ||
| 117 | + short[] samples_int16 = new short[_header.SubChunk2Size / 2]; | ||
| 118 | + Buffer.BlockCopy(buffer, 0, samples_int16, 0, buffer.Length); | ||
| 119 | + | ||
| 120 | + _samples = new float[samples_int16.Length]; | ||
| 121 | + | ||
| 122 | + for (var i = 0; i < samples_int16.Length; ++i) | ||
| 123 | + { | ||
| 124 | + _samples[i] = samples_int16[i] / 32768.0F; | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + private static WaveHeader ReadHeader(BinaryReader reader) | ||
| 131 | + { | ||
| 132 | + byte[] bytes = reader.ReadBytes(Marshal.SizeOf(typeof(WaveHeader))); | ||
| 133 | + | ||
| 134 | + GCHandle handle = GCHandle.Alloc(bytes, GCHandleType.Pinned); | ||
| 135 | + WaveHeader header = (WaveHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(WaveHeader))!; | ||
| 136 | + handle.Free(); | ||
| 137 | + | ||
| 138 | + return header; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + private void SkipMetaData(BinaryReader reader) | ||
| 142 | + { | ||
| 143 | + var bs = reader.BaseStream; | ||
| 144 | + | ||
| 145 | + Int32 subChunk2ID = _header.SubChunk2ID; | ||
| 146 | + Int32 subChunk2Size = _header.SubChunk2Size; | ||
| 147 | + | ||
| 148 | + while (bs.Position != bs.Length && subChunk2ID != 0x61746164) | ||
| 149 | + { | ||
| 150 | + bs.Seek(subChunk2Size, SeekOrigin.Current); | ||
| 151 | + subChunk2ID = reader.ReadInt32(); | ||
| 152 | + subChunk2Size = reader.ReadInt32(); | ||
| 153 | + } | ||
| 154 | + _header.SubChunk2ID = subChunk2ID; | ||
| 155 | + _header.SubChunk2Size = subChunk2Size; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + private WaveHeader _header; | ||
| 159 | + | ||
| 160 | + // Samples are normalized to the range [-1, 1] | ||
| 161 | + private float[] _samples; | ||
| 162 | + | ||
| 163 | + public int SampleRate => _header.SampleRate; | ||
| 164 | + public float[] Samples => _samples; | ||
| 165 | + | ||
| 166 | + public static void Test(String fileName) | ||
| 167 | + { | ||
| 168 | + WaveReader reader = new WaveReader(fileName); | ||
| 169 | + Console.WriteLine($"samples length: {reader.Samples.Length}"); | ||
| 170 | + Console.WriteLine($"samples rate: {reader.SampleRate}"); | ||
| 171 | + } | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | +} |
| 1 | -../online-decode-files/WaveReader.cs |
| @@ -9,8 +9,7 @@ | @@ -9,8 +9,7 @@ | ||
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | <ItemGroup> | 11 | <ItemGroup> |
| 12 | - <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 13 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 14 | </ItemGroup> | 13 | </ItemGroup> |
| 15 | 14 | ||
| 16 | </Project> | 15 | </Project> |
| 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 | - static void Main(string[] args) | ||
| 21 | - { | ||
| 22 | - var config = new OfflinePunctuationConfig(); | ||
| 23 | - config.Model.CtTransformer = "./sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12/model.onnx"; | ||
| 24 | - config.Model.Debug = 1; | ||
| 25 | - config.Model.NumThreads = 1; | ||
| 26 | - var punct = new OfflinePunctuation(config); | ||
| 27 | - | ||
| 28 | - string[] textList = new string[] { | ||
| 29 | - "这是一个测试你好吗How are you我很好thank you are you ok谢谢你", | ||
| 30 | - "我们都是木头人不会说话不会动", | ||
| 31 | - "The African blogosphere is rapidly expanding bringing more voices online in the form of commentaries opinions analyses rants and poetry", | ||
| 32 | - }; | ||
| 33 | - | ||
| 34 | - Console.WriteLine("---------"); | ||
| 35 | - foreach (string text in textList) | ||
| 36 | - { | ||
| 37 | - string textWithPunct = punct.AddPunct(text); | ||
| 38 | - Console.WriteLine("Input text: {0}", text); | ||
| 39 | - Console.WriteLine("Output text: {0}", textWithPunct); | ||
| 40 | - Console.WriteLine("---------"); | ||
| 41 | - } | ||
| 42 | - } | ||
| 43 | -} | 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 | + static void Main(string[] args) | ||
| 21 | + { | ||
| 22 | + var config = new OfflinePunctuationConfig(); | ||
| 23 | + config.Model.CtTransformer = "./sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12/model.onnx"; | ||
| 24 | + config.Model.Debug = 1; | ||
| 25 | + config.Model.NumThreads = 1; | ||
| 26 | + var punct = new OfflinePunctuation(config); | ||
| 27 | + | ||
| 28 | + string[] textList = new string[] { | ||
| 29 | + "这是一个测试你好吗How are you我很好thank you are you ok谢谢你", | ||
| 30 | + "我们都是木头人不会说话不会动", | ||
| 31 | + "The African blogosphere is rapidly expanding bringing more voices online in the form of commentaries opinions analyses rants and poetry", | ||
| 32 | + }; | ||
| 33 | + | ||
| 34 | + Console.WriteLine("---------"); | ||
| 35 | + foreach (string text in textList) | ||
| 36 | + { | ||
| 37 | + string textWithPunct = punct.AddPunct(text); | ||
| 38 | + Console.WriteLine("Input text: {0}", text); | ||
| 39 | + Console.WriteLine("Output text: {0}", textWithPunct); | ||
| 40 | + Console.WriteLine("---------"); | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | +} |
| 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> | 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 | + <ProjectReference Include="..\Common\Common.csproj" /> | ||
| 13 | + </ItemGroup> | ||
| 14 | + | ||
| 15 | +</Project> |
dotnet-examples/offline-punctuation/run.sh
100755 → 100644
| @@ -9,9 +9,11 @@ | @@ -9,9 +9,11 @@ | ||
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | <ItemGroup> | 11 | <ItemGroup> |
| 12 | - <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 13 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | ||
| 14 | <PackageReference Include="PortAudioSharp2" Version="*" /> | 12 | <PackageReference Include="PortAudioSharp2" Version="*" /> |
| 15 | </ItemGroup> | 13 | </ItemGroup> |
| 16 | 14 | ||
| 15 | + <ItemGroup> | ||
| 16 | + <ProjectReference Include="..\Common\Common.csproj" /> | ||
| 17 | + </ItemGroup> | ||
| 18 | + | ||
| 17 | </Project> | 19 | </Project> |
| @@ -9,8 +9,7 @@ | @@ -9,8 +9,7 @@ | ||
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | <ItemGroup> | 11 | <ItemGroup> |
| 12 | - <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 13 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 14 | </ItemGroup> | 13 | </ItemGroup> |
| 15 | 14 | ||
| 16 | </Project> | 15 | </Project> |
| @@ -9,8 +9,7 @@ | @@ -9,8 +9,7 @@ | ||
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | <ItemGroup> | 11 | <ItemGroup> |
| 12 | - <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 13 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 14 | </ItemGroup> | 13 | </ItemGroup> |
| 15 | 14 | ||
| 16 | </Project> | 15 | </Project> |
| @@ -3,34 +3,33 @@ Microsoft Visual Studio Solution File, Format Version 12.00 | @@ -3,34 +3,33 @@ Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| 3 | # Visual Studio Version 17 | 3 | # Visual Studio Version 17 |
| 4 | VisualStudioVersion = 17.0.31903.59 | 4 | VisualStudioVersion = 17.0.31903.59 |
| 5 | MinimumVisualStudioVersion = 10.0.40219.1 | 5 | MinimumVisualStudioVersion = 10.0.40219.1 |
| 6 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "online-decode-files", "online-decode-files\online-decode-files.csproj", "{45307474-BECB-4ABE-9388-D01D55A1A9BE}" | 6 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "online-decode-files", "online-decode-files\online-decode-files.csproj", "{45307474-BECB-4ABE-9388-D01D55A1A9BE}" |
| 7 | EndProject | 7 | EndProject |
| 8 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "offline-decode-files", "offline-decode-files\offline-decode-files.csproj", "{2DAB152C-9E24-47A0-9DB0-781297ECE458}" | 8 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "offline-decode-files", "offline-decode-files\offline-decode-files.csproj", "{2DAB152C-9E24-47A0-9DB0-781297ECE458}" |
| 9 | EndProject | 9 | EndProject |
| 10 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "speech-recognition-from-microphone", "speech-recognition-from-microphone\speech-recognition-from-microphone.csproj", "{FE4EA1FF-062A-46B3-B78D-C828FED7B82E}" | 10 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "speech-recognition-from-microphone", "speech-recognition-from-microphone\speech-recognition-from-microphone.csproj", "{FE4EA1FF-062A-46B3-B78D-C828FED7B82E}" |
| 11 | EndProject | 11 | EndProject |
| 12 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "offline-tts", "offline-tts\offline-tts.csproj", "{72196886-7143-4043-96E2-BCACEC6C79EB}" | 12 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "offline-tts", "offline-tts\offline-tts.csproj", "{72196886-7143-4043-96E2-BCACEC6C79EB}" |
| 13 | EndProject | 13 | EndProject |
| 14 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "offline-tts-play", "offline-tts-play\offline-tts-play.csproj", "{40781464-5948-462B-BA4B-98932711513F}" | 14 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "offline-tts-play", "offline-tts-play\offline-tts-play.csproj", "{40781464-5948-462B-BA4B-98932711513F}" |
| 15 | EndProject | 15 | EndProject |
| 16 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spoken-language-identification", "spoken-language-identification\spoken-language-identification.csproj", "{3D7CF3D6-AC45-4D50-9619-5687B1443E94}" | 16 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "spoken-language-identification", "spoken-language-identification\spoken-language-identification.csproj", "{3D7CF3D6-AC45-4D50-9619-5687B1443E94}" |
| 17 | EndProject | 17 | EndProject |
| 18 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "streaming-hlg-decoding", "streaming-hlg-decoding\streaming-hlg-decoding.csproj", "{C4A368A5-FCA0-419D-97C9-C8CE0B08EB99}" | 18 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "streaming-hlg-decoding", "streaming-hlg-decoding\streaming-hlg-decoding.csproj", "{C4A368A5-FCA0-419D-97C9-C8CE0B08EB99}" |
| 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("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "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}" | 22 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "offline-punctuation", "offline-punctuation\offline-punctuation.csproj", "{42D85582-BB63-4259-A4EA-837D66AC078B}" |
| 23 | EndProject | 23 | EndProject |
| 24 | -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vad-non-streaming-asr-paraformer", "vad-non-streaming-asr-paraformer\vad-non-streaming-asr-paraformer.csproj", "{8CD6B7E5-F59F-47B3-BB87-2B2E3678924D}" | 24 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vad-non-streaming-asr-paraformer", "vad-non-streaming-asr-paraformer\vad-non-streaming-asr-paraformer.csproj", "{8CD6B7E5-F59F-47B3-BB87-2B2E3678924D}" |
| 25 | +EndProject | ||
| 26 | +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{401E963F-E25A-43CE-987D-8DB2D4715756}" | ||
| 25 | EndProject | 27 | EndProject |
| 26 | Global | 28 | Global |
| 27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | 29 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
| 28 | Debug|Any CPU = Debug|Any CPU | 30 | Debug|Any CPU = Debug|Any CPU |
| 29 | Release|Any CPU = Release|Any CPU | 31 | Release|Any CPU = Release|Any CPU |
| 30 | EndGlobalSection | 32 | EndGlobalSection |
| 31 | - GlobalSection(SolutionProperties) = preSolution | ||
| 32 | - HideSolutionNode = FALSE | ||
| 33 | - EndGlobalSection | ||
| 34 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | 33 | GlobalSection(ProjectConfigurationPlatforms) = postSolution |
| 35 | {45307474-BECB-4ABE-9388-D01D55A1A9BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | 34 | {45307474-BECB-4ABE-9388-D01D55A1A9BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
| 36 | {45307474-BECB-4ABE-9388-D01D55A1A9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU | 35 | {45307474-BECB-4ABE-9388-D01D55A1A9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| @@ -72,5 +71,15 @@ Global | @@ -72,5 +71,15 @@ Global | ||
| 72 | {8CD6B7E5-F59F-47B3-BB87-2B2E3678924D}.Debug|Any CPU.Build.0 = Debug|Any CPU | 71 | {8CD6B7E5-F59F-47B3-BB87-2B2E3678924D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| 73 | {8CD6B7E5-F59F-47B3-BB87-2B2E3678924D}.Release|Any CPU.ActiveCfg = Release|Any CPU | 72 | {8CD6B7E5-F59F-47B3-BB87-2B2E3678924D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| 74 | {8CD6B7E5-F59F-47B3-BB87-2B2E3678924D}.Release|Any CPU.Build.0 = Release|Any CPU | 73 | {8CD6B7E5-F59F-47B3-BB87-2B2E3678924D}.Release|Any CPU.Build.0 = Release|Any CPU |
| 74 | + {401E963F-E25A-43CE-987D-8DB2D4715756}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 75 | + {401E963F-E25A-43CE-987D-8DB2D4715756}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 76 | + {401E963F-E25A-43CE-987D-8DB2D4715756}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 77 | + {401E963F-E25A-43CE-987D-8DB2D4715756}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 78 | + EndGlobalSection | ||
| 79 | + GlobalSection(SolutionProperties) = preSolution | ||
| 80 | + HideSolutionNode = FALSE | ||
| 81 | + EndGlobalSection | ||
| 82 | + GlobalSection(ExtensibilityGlobals) = postSolution | ||
| 83 | + SolutionGuid = {07A6023C-0A37-4F82-A29F-896A3A338EAC} | ||
| 75 | EndGlobalSection | 84 | EndGlobalSection |
| 76 | EndGlobal | 85 | EndGlobal |
| 1 | -../offline-decode-files/WaveReader.cs |
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | <ItemGroup> | 11 | <ItemGroup> |
| 12 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 13 | </ItemGroup> | 13 | </ItemGroup> |
| 14 | 14 | ||
| 15 | </Project> | 15 | </Project> |
| @@ -9,9 +9,11 @@ | @@ -9,9 +9,11 @@ | ||
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | <ItemGroup> | 11 | <ItemGroup> |
| 12 | - <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 13 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | ||
| 14 | <PackageReference Include="PortAudioSharp2" Version="*" /> | 12 | <PackageReference Include="PortAudioSharp2" Version="*" /> |
| 15 | </ItemGroup> | 13 | </ItemGroup> |
| 16 | 14 | ||
| 15 | + <ItemGroup> | ||
| 16 | + <ProjectReference Include="..\Common\Common.csproj" /> | ||
| 17 | + </ItemGroup> | ||
| 18 | + | ||
| 17 | </Project> | 19 | </Project> |
| 1 | -../offline-decode-files/WaveReader.cs |
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | <ItemGroup> | 11 | <ItemGroup> |
| 12 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 13 | </ItemGroup> | 13 | </ItemGroup> |
| 14 | 14 | ||
| 15 | </Project> | 15 | </Project> |
| 1 | -../online-decode-files/WaveReader.cs |
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | <ItemGroup> | 11 | <ItemGroup> |
| 12 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 13 | </ItemGroup> | 13 | </ItemGroup> |
| 14 | 14 | ||
| 15 | </Project> | 15 | </Project> |
| 1 | -// Copyright (c) 2024 Xiaomi Corporation | ||
| 2 | -// | ||
| 3 | -// This file shows how to use a silero_vad model with a non-streaming Paraformer | ||
| 4 | -// for speech recognition. | ||
| 5 | -using SherpaOnnx; | ||
| 6 | -using System.Collections.Generic; | ||
| 7 | -using System; | ||
| 8 | - | ||
| 9 | -class VadNonStreamingAsrParaformer | ||
| 10 | -{ | ||
| 11 | - static void Main(string[] args) | ||
| 12 | - { | ||
| 13 | - // please download model files from | ||
| 14 | - // https://github.com/k2-fsa/sherpa-onnx/releases/tag/asr-models | ||
| 15 | - OfflineRecognizerConfig config = new OfflineRecognizerConfig(); | ||
| 16 | - config.ModelConfig.Paraformer.Model = "./sherpa-onnx-paraformer-zh-2023-03-28/model.int8.onnx"; | ||
| 17 | - config.ModelConfig.Tokens = "./sherpa-onnx-paraformer-zh-2023-03-28/tokens.txt"; | ||
| 18 | - config.ModelConfig.Debug = 0; | ||
| 19 | - OfflineRecognizer recognizer = new OfflineRecognizer(config); | ||
| 20 | - | ||
| 21 | - VadModelConfig vadModelConfig = new VadModelConfig(); | ||
| 22 | - vadModelConfig.SileroVad.Model = "./silero_vad.onnx"; | ||
| 23 | - vadModelConfig.Debug = 0; | ||
| 24 | - | ||
| 25 | - VoiceActivityDetector vad = new VoiceActivityDetector(vadModelConfig, 60); | ||
| 26 | - | ||
| 27 | - string testWaveFilename = "./lei-jun-test.wav"; | ||
| 28 | - WaveReader reader = new WaveReader(testWaveFilename); | ||
| 29 | - | ||
| 30 | - int numSamples = reader.Samples.Length; | ||
| 31 | - int windowSize = vadModelConfig.SileroVad.WindowSize; | ||
| 32 | - int sampleRate = vadModelConfig.SampleRate; | ||
| 33 | - int numIter = numSamples / windowSize; | ||
| 34 | - | ||
| 35 | - for (int i = 0; i != numIter; ++i) { | ||
| 36 | - int start = i * windowSize; | ||
| 37 | - float[] samples = new float[windowSize]; | ||
| 38 | - Array.Copy(reader.Samples, start, samples, 0, windowSize); | ||
| 39 | - vad.AcceptWaveform(samples); | ||
| 40 | - if (vad.IsSpeechDetected()) { | ||
| 41 | - while (!vad.IsEmpty()) { | ||
| 42 | - SpeechSegment segment = vad.Front(); | ||
| 43 | - float startTime = segment.Start / (float)sampleRate; | ||
| 44 | - float duration = segment.Samples.Length / (float)sampleRate; | ||
| 45 | - | ||
| 46 | - OfflineStream stream = recognizer.CreateStream(); | ||
| 47 | - stream.AcceptWaveform(sampleRate, segment.Samples); | ||
| 48 | - recognizer.Decode(stream); | ||
| 49 | - String text = stream.Result.Text; | ||
| 50 | - | ||
| 51 | - if (!String.IsNullOrEmpty(text)) { | ||
| 52 | - Console.WriteLine("{0}--{1}: {2}", String.Format("{0:0.00}", startTime), | ||
| 53 | - String.Format("{0:0.00}", startTime+duration), text); | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - vad.Pop(); | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | - } | ||
| 61 | -} | ||
| 62 | - | 1 | +// Copyright (c) 2024 Xiaomi Corporation |
| 2 | +// | ||
| 3 | +// This file shows how to use a silero_vad model with a non-streaming Paraformer | ||
| 4 | +// for speech recognition. | ||
| 5 | +using SherpaOnnx; | ||
| 6 | +using System.Collections.Generic; | ||
| 7 | +using System; | ||
| 8 | + | ||
| 9 | +class VadNonStreamingAsrParaformer | ||
| 10 | +{ | ||
| 11 | + static void Main(string[] args) | ||
| 12 | + { | ||
| 13 | + // please download model files from | ||
| 14 | + // https://github.com/k2-fsa/sherpa-onnx/releases/tag/asr-models | ||
| 15 | + OfflineRecognizerConfig config = new OfflineRecognizerConfig(); | ||
| 16 | + config.ModelConfig.Paraformer.Model = "./sherpa-onnx-paraformer-zh-2023-03-28/model.int8.onnx"; | ||
| 17 | + config.ModelConfig.Tokens = "./sherpa-onnx-paraformer-zh-2023-03-28/tokens.txt"; | ||
| 18 | + config.ModelConfig.Debug = 0; | ||
| 19 | + OfflineRecognizer recognizer = new OfflineRecognizer(config); | ||
| 20 | + | ||
| 21 | + VadModelConfig vadModelConfig = new VadModelConfig(); | ||
| 22 | + vadModelConfig.SileroVad.Model = "./silero_vad.onnx"; | ||
| 23 | + vadModelConfig.Debug = 0; | ||
| 24 | + | ||
| 25 | + VoiceActivityDetector vad = new VoiceActivityDetector(vadModelConfig, 60); | ||
| 26 | + | ||
| 27 | + string testWaveFilename = "./lei-jun-test.wav"; | ||
| 28 | + WaveReader reader = new WaveReader(testWaveFilename); | ||
| 29 | + | ||
| 30 | + int numSamples = reader.Samples.Length; | ||
| 31 | + int windowSize = vadModelConfig.SileroVad.WindowSize; | ||
| 32 | + int sampleRate = vadModelConfig.SampleRate; | ||
| 33 | + int numIter = numSamples / windowSize; | ||
| 34 | + | ||
| 35 | + for (int i = 0; i != numIter; ++i) { | ||
| 36 | + int start = i * windowSize; | ||
| 37 | + float[] samples = new float[windowSize]; | ||
| 38 | + Array.Copy(reader.Samples, start, samples, 0, windowSize); | ||
| 39 | + vad.AcceptWaveform(samples); | ||
| 40 | + if (vad.IsSpeechDetected()) { | ||
| 41 | + while (!vad.IsEmpty()) { | ||
| 42 | + SpeechSegment segment = vad.Front(); | ||
| 43 | + float startTime = segment.Start / (float)sampleRate; | ||
| 44 | + float duration = segment.Samples.Length / (float)sampleRate; | ||
| 45 | + | ||
| 46 | + OfflineStream stream = recognizer.CreateStream(); | ||
| 47 | + stream.AcceptWaveform(sampleRate, segment.Samples); | ||
| 48 | + recognizer.Decode(stream); | ||
| 49 | + String text = stream.Result.Text; | ||
| 50 | + | ||
| 51 | + if (!String.IsNullOrEmpty(text)) { | ||
| 52 | + Console.WriteLine("{0}--{1}: {2}", String.Format("{0:0.00}", startTime), | ||
| 53 | + String.Format("{0:0.00}", startTime+duration), text); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + vad.Pop(); | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | +} | ||
| 62 | + |
| 1 | -../online-decode-files/WaveReader.cs |
dotnet-examples/vad-non-streaming-asr-paraformer/run.sh
100755 → 100644
| 1 | -<Project Sdk="Microsoft.NET.Sdk"> | ||
| 2 | - | ||
| 3 | - <PropertyGroup> | ||
| 4 | - <OutputType>Exe</OutputType> | ||
| 5 | - <TargetFramework>net6.0</TargetFramework> | ||
| 6 | - <RootNamespace>vad_non_streaming_asr_paraformer</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> | 1 | +<Project Sdk="Microsoft.NET.Sdk"> |
| 2 | + | ||
| 3 | + <PropertyGroup> | ||
| 4 | + <OutputType>Exe</OutputType> | ||
| 5 | + <TargetFramework>net6.0</TargetFramework> | ||
| 6 | + <RootNamespace>vad_non_streaming_asr_paraformer</RootNamespace> | ||
| 7 | + <ImplicitUsings>enable</ImplicitUsings> | ||
| 8 | + <Nullable>enable</Nullable> | ||
| 9 | + </PropertyGroup> | ||
| 10 | + | ||
| 11 | + <ItemGroup> | ||
| 12 | + <ProjectReference Include="..\Common\Common.csproj" /> | ||
| 13 | + </ItemGroup> | ||
| 14 | + | ||
| 15 | +</Project> |
| 1 | -/// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) | 1 | +/// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | -using System.Runtime.InteropServices; | ||
| 6 | -using System.Text; | ||
| 7 | using System; | 3 | using System; |
| 4 | +using System.Runtime.InteropServices; | ||
| 8 | 5 | ||
| 9 | namespace SherpaOnnx | 6 | namespace SherpaOnnx |
| 10 | { | 7 | { |
| @@ -2,12 +2,6 @@ | @@ -2,12 +2,6 @@ | ||
| 2 | /// Copyright (c) 2023 by manyeyes | 2 | /// Copyright (c) 2023 by manyeyes |
| 3 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 4 | 4 | ||
| 5 | -using System.Collections.Generic; | ||
| 6 | -using System.Linq; | ||
| 7 | -using System.Runtime.InteropServices; | ||
| 8 | -using System.Text; | ||
| 9 | -using System; | ||
| 10 | - | ||
| 11 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 12 | { | 6 | { |
| 13 | internal static class Dll | 7 | internal static class Dll |
| @@ -2,11 +2,7 @@ | @@ -2,11 +2,7 @@ | ||
| 2 | /// Copyright (c) 2023 by manyeyes | 2 | /// Copyright (c) 2023 by manyeyes |
| 3 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 4 | 4 | ||
| 5 | -using System.Collections.Generic; | ||
| 6 | -using System.Linq; | ||
| 7 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
| 8 | -using System.Text; | ||
| 9 | -using System; | ||
| 10 | 6 | ||
| 11 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 12 | { | 8 | { |
| @@ -29,4 +25,4 @@ namespace SherpaOnnx | @@ -29,4 +25,4 @@ namespace SherpaOnnx | ||
| 29 | public int FeatureDim; | 25 | public int FeatureDim; |
| 30 | } | 26 | } |
| 31 | 27 | ||
| 32 | -} | 28 | +} |
| 1 | +/// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang) | ||
| 2 | +/// Copyright (c) 2023 by manyeyes | ||
| 1 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 4 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 6 | ||
| 9 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 10 | { | 8 | { |
| 9 | + | ||
| 11 | [StructLayout(LayoutKind.Sequential)] | 10 | [StructLayout(LayoutKind.Sequential)] |
| 12 | public struct OfflineLMConfig | 11 | public struct OfflineLMConfig |
| 13 | { | 12 | { |
| @@ -21,4 +20,5 @@ namespace SherpaOnnx | @@ -21,4 +20,5 @@ namespace SherpaOnnx | ||
| 21 | 20 | ||
| 22 | public float Scale; | 21 | public float Scale; |
| 23 | } | 22 | } |
| 24 | -} | 23 | + |
| 24 | +} |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 7 | + | ||
| 11 | [StructLayout(LayoutKind.Sequential)] | 8 | [StructLayout(LayoutKind.Sequential)] |
| 12 | public struct OfflineModelConfig | 9 | public struct OfflineModelConfig |
| 13 | { | 10 | { |
| @@ -55,4 +52,6 @@ namespace SherpaOnnx | @@ -55,4 +52,6 @@ namespace SherpaOnnx | ||
| 55 | [MarshalAs(UnmanagedType.LPStr)] | 52 | [MarshalAs(UnmanagedType.LPStr)] |
| 56 | public string TeleSpeechCtc; | 53 | public string TeleSpeechCtc; |
| 57 | } | 54 | } |
| 58 | -} | 55 | + |
| 56 | + | ||
| 57 | +} |
| 1 | +/// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang) | ||
| 2 | +/// Copyright (c) 2023 by manyeyes | ||
| 1 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 4 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 6 | ||
| 9 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 10 | { | 8 | { |
| 9 | + | ||
| 11 | [StructLayout(LayoutKind.Sequential)] | 10 | [StructLayout(LayoutKind.Sequential)] |
| 12 | public struct OfflineNemoEncDecCtcModelConfig | 11 | public struct OfflineNemoEncDecCtcModelConfig |
| 13 | { | 12 | { |
| @@ -18,4 +17,4 @@ namespace SherpaOnnx | @@ -18,4 +17,4 @@ namespace SherpaOnnx | ||
| 18 | [MarshalAs(UnmanagedType.LPStr)] | 17 | [MarshalAs(UnmanagedType.LPStr)] |
| 19 | public string Model; | 18 | public string Model; |
| 20 | } | 19 | } |
| 21 | -} | 20 | +} |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| @@ -18,4 +14,5 @@ namespace SherpaOnnx | @@ -18,4 +14,5 @@ namespace SherpaOnnx | ||
| 18 | [MarshalAs(UnmanagedType.LPStr)] | 14 | [MarshalAs(UnmanagedType.LPStr)] |
| 19 | public string Model; | 15 | public string Model; |
| 20 | } | 16 | } |
| 21 | -} | 17 | + |
| 18 | +} |
| 1 | -/// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) | ||
| 2 | - | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | 1 | +/// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) |
| 2 | +using System; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | using System.Text; | 4 | using System.Text; |
| 7 | -using System; | 5 | + |
| 8 | 6 | ||
| 9 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 10 | { | 8 | { |
| 1 | /// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) | 1 | /// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 1 | /// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) | 1 | /// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 1 | -/// Copyright (c) 2024.5 by 东风破 | 1 | +/// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | 3 | +using System; |
| 4 | using System.Collections.Generic; | 4 | using System.Collections.Generic; |
| 5 | +using System.Linq; | ||
| 5 | using System.Runtime.InteropServices; | 6 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 7 | ||
| 9 | namespace SherpaOnnx | 8 | namespace SherpaOnnx |
| 10 | { | 9 | { |
| @@ -72,4 +71,5 @@ namespace SherpaOnnx | @@ -72,4 +71,5 @@ namespace SherpaOnnx | ||
| 72 | [DllImport(Dll.Filename, EntryPoint = "DecodeMultipleOfflineStreams")] | 71 | [DllImport(Dll.Filename, EntryPoint = "DecodeMultipleOfflineStreams")] |
| 73 | private static extern void Decode(IntPtr handle, IntPtr[] streams, int n); | 72 | private static extern void Decode(IntPtr handle, IntPtr[] streams, int n); |
| 74 | } | 73 | } |
| 74 | + | ||
| 75 | } | 75 | } |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 7 | + | ||
| 11 | [StructLayout(LayoutKind.Sequential)] | 8 | [StructLayout(LayoutKind.Sequential)] |
| 12 | public struct OfflineRecognizerConfig | 9 | public struct OfflineRecognizerConfig |
| 13 | { | 10 | { |
| @@ -44,4 +41,6 @@ namespace SherpaOnnx | @@ -44,4 +41,6 @@ namespace SherpaOnnx | ||
| 44 | [MarshalAs(UnmanagedType.LPStr)] | 41 | [MarshalAs(UnmanagedType.LPStr)] |
| 45 | public string RuleFars; | 42 | public string RuleFars; |
| 46 | } | 43 | } |
| 47 | -} | 44 | + |
| 45 | + | ||
| 46 | +} |
| 1 | -/// Copyright (c) 2024.5 by 东风破 | 1 | +/// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | 3 | +using System; |
| 5 | using System.Runtime.InteropServices; | 4 | using System.Runtime.InteropServices; |
| 6 | using System.Text; | 5 | using System.Text; |
| 7 | -using System; | ||
| 8 | 6 | ||
| 9 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 10 | { | 8 | { |
| 9 | + | ||
| 11 | public class OfflineRecognizerResult | 10 | public class OfflineRecognizerResult |
| 12 | { | 11 | { |
| 13 | public OfflineRecognizerResult(IntPtr handle) | 12 | public OfflineRecognizerResult(IntPtr handle) |
| @@ -43,4 +42,6 @@ namespace SherpaOnnx | @@ -43,4 +42,6 @@ namespace SherpaOnnx | ||
| 43 | private String _text; | 42 | private String _text; |
| 44 | public String Text => _text; | 43 | public String Text => _text; |
| 45 | } | 44 | } |
| 45 | + | ||
| 46 | + | ||
| 46 | } | 47 | } |
| 1 | -/// Copyright (c) 2024.5 by 东风破 | 1 | +/// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | -using System.Runtime.InteropServices; | ||
| 6 | -using System.Text; | ||
| 7 | using System; | 3 | using System; |
| 4 | +using System.Runtime.InteropServices; | ||
| 8 | 5 | ||
| 9 | namespace SherpaOnnx | 6 | namespace SherpaOnnx |
| 10 | { | 7 | { |
| 8 | + | ||
| 11 | public class OfflineStream : IDisposable | 9 | public class OfflineStream : IDisposable |
| 12 | { | 10 | { |
| 13 | public OfflineStream(IntPtr p) | 11 | public OfflineStream(IntPtr p) |
| @@ -67,4 +65,5 @@ namespace SherpaOnnx | @@ -67,4 +65,5 @@ namespace SherpaOnnx | ||
| 67 | [DllImport(Dll.Filename, EntryPoint = "DestroyOfflineRecognizerResult")] | 65 | [DllImport(Dll.Filename, EntryPoint = "DestroyOfflineRecognizerResult")] |
| 68 | private static extern void DestroyResult(IntPtr handle); | 66 | private static extern void DestroyResult(IntPtr handle); |
| 69 | } | 67 | } |
| 68 | + | ||
| 70 | } | 69 | } |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| @@ -18,4 +14,5 @@ namespace SherpaOnnx | @@ -18,4 +14,5 @@ namespace SherpaOnnx | ||
| 18 | [MarshalAs(UnmanagedType.LPStr)] | 14 | [MarshalAs(UnmanagedType.LPStr)] |
| 19 | public string Model; | 15 | public string Model; |
| 20 | } | 16 | } |
| 21 | -} | 17 | + |
| 18 | +} |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| @@ -26,4 +22,5 @@ namespace SherpaOnnx | @@ -26,4 +22,5 @@ namespace SherpaOnnx | ||
| 26 | [MarshalAs(UnmanagedType.LPStr)] | 22 | [MarshalAs(UnmanagedType.LPStr)] |
| 27 | public string Joiner; | 23 | public string Joiner; |
| 28 | } | 24 | } |
| 29 | -} | 25 | + |
| 26 | +} |
| 1 | -/// Copyright (c) 2024.5 by 东风破 | ||
| 2 | - | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | -using System.Runtime.InteropServices; | ||
| 6 | -using System.Text; | 1 | +/// Copyright (c) 2024.5 by 东风破 |
| 7 | using System; | 2 | using System; |
| 3 | +using System.Runtime.InteropServices; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| @@ -28,4 +24,5 @@ namespace SherpaOnnx | @@ -28,4 +24,5 @@ namespace SherpaOnnx | ||
| 28 | [MarshalAs(UnmanagedType.LPStr)] | 24 | [MarshalAs(UnmanagedType.LPStr)] |
| 29 | public string RuleFars; | 25 | public string RuleFars; |
| 30 | } | 26 | } |
| 31 | -} | 27 | + |
| 28 | +} |
| 1 | -/// Copyright (c) 2024.5 by 东风破 | ||
| 2 | - | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | -using System.Runtime.InteropServices; | ||
| 6 | -using System.Text; | 1 | +/// Copyright (c) 2024.5 by 东风破 |
| 7 | using System; | 2 | using System; |
| 3 | +using System.Runtime.InteropServices; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| @@ -90,4 +86,4 @@ namespace SherpaOnnx | @@ -90,4 +86,4 @@ namespace SherpaOnnx | ||
| 90 | [DllImport(Dll.Filename)] | 86 | [DllImport(Dll.Filename)] |
| 91 | private static extern int SherpaOnnxWriteWave(IntPtr samples, int n, int sample_rate, [MarshalAs(UnmanagedType.LPStr)] string filename); | 87 | private static extern int SherpaOnnxWriteWave(IntPtr samples, int n, int sample_rate, [MarshalAs(UnmanagedType.LPStr)] string filename); |
| 92 | } | 88 | } |
| 93 | -} | ||
| 89 | +} |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 7 | + | ||
| 11 | [StructLayout(LayoutKind.Sequential)] | 8 | [StructLayout(LayoutKind.Sequential)] |
| 12 | public struct OfflineTtsModelConfig | 9 | public struct OfflineTtsModelConfig |
| 13 | { | 10 | { |
| @@ -25,4 +22,4 @@ namespace SherpaOnnx | @@ -25,4 +22,4 @@ namespace SherpaOnnx | ||
| 25 | [MarshalAs(UnmanagedType.LPStr)] | 22 | [MarshalAs(UnmanagedType.LPStr)] |
| 26 | public string Provider; | 23 | public string Provider; |
| 27 | } | 24 | } |
| 28 | -} | 25 | +} |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| @@ -33,4 +29,5 @@ namespace SherpaOnnx | @@ -33,4 +29,5 @@ namespace SherpaOnnx | ||
| 33 | 29 | ||
| 34 | public int TailPaddings; | 30 | public int TailPaddings; |
| 35 | } | 31 | } |
| 36 | -} | 32 | + |
| 33 | +} |
| @@ -2,11 +2,7 @@ | @@ -2,11 +2,7 @@ | ||
| 2 | /// Copyright (c) 2023 by manyeyes | 2 | /// Copyright (c) 2023 by manyeyes |
| 3 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 4 | 4 | ||
| 5 | -using System.Collections.Generic; | ||
| 6 | -using System.Linq; | ||
| 7 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
| 8 | -using System.Text; | ||
| 9 | -using System; | ||
| 10 | 6 | ||
| 11 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 12 | { | 8 | { |
| @@ -24,4 +20,5 @@ namespace SherpaOnnx | @@ -24,4 +20,5 @@ namespace SherpaOnnx | ||
| 24 | 20 | ||
| 25 | public int MaxActive; | 21 | public int MaxActive; |
| 26 | } | 22 | } |
| 27 | -} | 23 | + |
| 24 | +} |
| @@ -2,14 +2,11 @@ | @@ -2,14 +2,11 @@ | ||
| 2 | /// Copyright (c) 2023 by manyeyes | 2 | /// Copyright (c) 2023 by manyeyes |
| 3 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 4 | 4 | ||
| 5 | -using System.Collections.Generic; | ||
| 6 | -using System.Linq; | ||
| 7 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
| 8 | -using System.Text; | ||
| 9 | -using System; | ||
| 10 | 6 | ||
| 11 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 12 | { | 8 | { |
| 9 | + | ||
| 13 | [StructLayout(LayoutKind.Sequential)] | 10 | [StructLayout(LayoutKind.Sequential)] |
| 14 | public struct OnlineModelConfig | 11 | public struct OnlineModelConfig |
| 15 | { | 12 | { |
| @@ -52,4 +49,5 @@ namespace SherpaOnnx | @@ -52,4 +49,5 @@ namespace SherpaOnnx | ||
| 52 | [MarshalAs(UnmanagedType.LPStr)] | 49 | [MarshalAs(UnmanagedType.LPStr)] |
| 53 | public string BpeVocab; | 50 | public string BpeVocab; |
| 54 | } | 51 | } |
| 55 | -} | 52 | + |
| 53 | +} |
| @@ -2,14 +2,11 @@ | @@ -2,14 +2,11 @@ | ||
| 2 | /// Copyright (c) 2023 by manyeyes | 2 | /// Copyright (c) 2023 by manyeyes |
| 3 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 4 | 4 | ||
| 5 | -using System.Collections.Generic; | ||
| 6 | -using System.Linq; | ||
| 7 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
| 8 | -using System.Text; | ||
| 9 | -using System; | ||
| 10 | 6 | ||
| 11 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 12 | { | 8 | { |
| 9 | + | ||
| 13 | [StructLayout(LayoutKind.Sequential)] | 10 | [StructLayout(LayoutKind.Sequential)] |
| 14 | public struct OnlineParaformerModelConfig | 11 | public struct OnlineParaformerModelConfig |
| 15 | { | 12 | { |
| @@ -25,4 +22,5 @@ namespace SherpaOnnx | @@ -25,4 +22,5 @@ namespace SherpaOnnx | ||
| 25 | [MarshalAs(UnmanagedType.LPStr)] | 22 | [MarshalAs(UnmanagedType.LPStr)] |
| 26 | public string Decoder; | 23 | public string Decoder; |
| 27 | } | 24 | } |
| 28 | -} | 25 | + |
| 26 | +} |
| 1 | -/// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang) | 1 | +/// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang) |
| 2 | /// Copyright (c) 2023 by manyeyes | 2 | /// Copyright (c) 2023 by manyeyes |
| 3 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 4 | - | 4 | +using System; |
| 5 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
| 6 | using System.Linq; | 6 | using System.Linq; |
| 7 | using System.Runtime.InteropServices; | 7 | using System.Runtime.InteropServices; |
| 8 | -using System.Text; | ||
| 9 | -using System; | ||
| 10 | 8 | ||
| 11 | namespace SherpaOnnx | 9 | namespace SherpaOnnx |
| 12 | { | 10 | { |
| @@ -122,4 +120,4 @@ namespace SherpaOnnx | @@ -122,4 +120,4 @@ namespace SherpaOnnx | ||
| 122 | [DllImport(Dll.Filename)] | 120 | [DllImport(Dll.Filename)] |
| 123 | private static extern int IsEndpoint(IntPtr handle, IntPtr stream); | 121 | private static extern int IsEndpoint(IntPtr handle, IntPtr stream); |
| 124 | } | 122 | } |
| 125 | -} | ||
| 123 | +} |
| @@ -2,14 +2,11 @@ | @@ -2,14 +2,11 @@ | ||
| 2 | /// Copyright (c) 2023 by manyeyes | 2 | /// Copyright (c) 2023 by manyeyes |
| 3 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 4 | 4 | ||
| 5 | -using System.Collections.Generic; | ||
| 6 | -using System.Linq; | ||
| 7 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
| 8 | -using System.Text; | ||
| 9 | -using System; | ||
| 10 | 6 | ||
| 11 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 12 | { | 8 | { |
| 9 | + | ||
| 13 | [StructLayout(LayoutKind.Sequential)] | 10 | [StructLayout(LayoutKind.Sequential)] |
| 14 | public struct OnlineRecognizerConfig | 11 | public struct OnlineRecognizerConfig |
| 15 | { | 12 | { |
| @@ -73,4 +70,5 @@ namespace SherpaOnnx | @@ -73,4 +70,5 @@ namespace SherpaOnnx | ||
| 73 | [MarshalAs(UnmanagedType.LPStr)] | 70 | [MarshalAs(UnmanagedType.LPStr)] |
| 74 | public string RuleFars; | 71 | public string RuleFars; |
| 75 | } | 72 | } |
| 76 | -} | 73 | + |
| 74 | +} |
| 1 | -/// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang) | 1 | +/// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang) |
| 2 | /// Copyright (c) 2023 by manyeyes | 2 | /// Copyright (c) 2023 by manyeyes |
| 3 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 4 | - | ||
| 5 | -using System.Collections.Generic; | ||
| 6 | -using System.Linq; | 4 | +using System; |
| 7 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
| 8 | using System.Text; | 6 | using System.Text; |
| 9 | -using System; | ||
| 10 | 7 | ||
| 11 | namespace SherpaOnnx | 8 | namespace SherpaOnnx |
| 12 | { | 9 | { |
| 10 | + | ||
| 13 | public class OnlineRecognizerResult | 11 | public class OnlineRecognizerResult |
| 14 | { | 12 | { |
| 15 | public OnlineRecognizerResult(IntPtr handle) | 13 | public OnlineRecognizerResult(IntPtr handle) |
| 1 | -/// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang) | 1 | +/// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang) |
| 2 | /// Copyright (c) 2023 by manyeyes | 2 | /// Copyright (c) 2023 by manyeyes |
| 3 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 4 | - | ||
| 5 | -using System.Collections.Generic; | ||
| 6 | -using System.Linq; | ||
| 7 | -using System.Runtime.InteropServices; | ||
| 8 | -using System.Text; | ||
| 9 | using System; | 4 | using System; |
| 5 | +using System.Runtime.InteropServices; | ||
| 10 | 6 | ||
| 11 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 12 | { | 8 | { |
| 9 | + | ||
| 13 | public class OnlineStream : IDisposable | 10 | public class OnlineStream : IDisposable |
| 14 | { | 11 | { |
| 15 | public OnlineStream(IntPtr p) | 12 | public OnlineStream(IntPtr p) |
| @@ -60,4 +57,5 @@ namespace SherpaOnnx | @@ -60,4 +57,5 @@ namespace SherpaOnnx | ||
| 60 | [DllImport(Dll.Filename)] | 57 | [DllImport(Dll.Filename)] |
| 61 | private static extern void InputFinished(IntPtr handle); | 58 | private static extern void InputFinished(IntPtr handle); |
| 62 | } | 59 | } |
| 60 | + | ||
| 63 | } | 61 | } |
| @@ -2,14 +2,11 @@ | @@ -2,14 +2,11 @@ | ||
| 2 | /// Copyright (c) 2023 by manyeyes | 2 | /// Copyright (c) 2023 by manyeyes |
| 3 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 4 | 4 | ||
| 5 | -using System.Collections.Generic; | ||
| 6 | -using System.Linq; | ||
| 7 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
| 8 | -using System.Text; | ||
| 9 | -using System; | ||
| 10 | 6 | ||
| 11 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 12 | { | 8 | { |
| 9 | + | ||
| 13 | [StructLayout(LayoutKind.Sequential)] | 10 | [StructLayout(LayoutKind.Sequential)] |
| 14 | public struct OnlineTransducerModelConfig | 11 | public struct OnlineTransducerModelConfig |
| 15 | { | 12 | { |
| @@ -29,4 +26,5 @@ namespace SherpaOnnx | @@ -29,4 +26,5 @@ namespace SherpaOnnx | ||
| 29 | [MarshalAs(UnmanagedType.LPStr)] | 26 | [MarshalAs(UnmanagedType.LPStr)] |
| 30 | public string Joiner; | 27 | public string Joiner; |
| 31 | } | 28 | } |
| 32 | -} | 29 | + |
| 30 | +} |
| @@ -2,11 +2,7 @@ | @@ -2,11 +2,7 @@ | ||
| 2 | /// Copyright (c) 2023 by manyeyes | 2 | /// Copyright (c) 2023 by manyeyes |
| 3 | /// Copyright (c) 2024.5 by 东风破 | 3 | /// Copyright (c) 2024.5 by 东风破 |
| 4 | 4 | ||
| 5 | -using System.Collections.Generic; | ||
| 6 | -using System.Linq; | ||
| 7 | using System.Runtime.InteropServices; | 5 | using System.Runtime.InteropServices; |
| 8 | -using System.Text; | ||
| 9 | -using System; | ||
| 10 | 6 | ||
| 11 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 12 | { | 8 | { |
| 1 | /// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) | 1 | /// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 1 | -/// Copyright (c) 2024.5 by 东风破 | ||
| 2 | - | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | -using System.Runtime.InteropServices; | ||
| 6 | -using System.Text; | 1 | +/// Copyright (c) 2024.5 by 东风破 |
| 7 | using System; | 2 | using System; |
| 3 | +using System.Runtime.InteropServices; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| @@ -93,4 +89,4 @@ namespace SherpaOnnx | @@ -93,4 +89,4 @@ namespace SherpaOnnx | ||
| 93 | private static extern void SherpaOnnxSpeakerEmbeddingExtractorDestroyEmbedding(IntPtr p); | 89 | private static extern void SherpaOnnxSpeakerEmbeddingExtractorDestroyEmbedding(IntPtr p); |
| 94 | } | 90 | } |
| 95 | 91 | ||
| 96 | -} | ||
| 92 | +} |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 1 | -/// Copyright (c) 2024.5 by 东风破 | ||
| 2 | - | ||
| 3 | -using System.Linq; | 1 | +/// Copyright (c) 2024.5 by 东风破 |
| 2 | +using System; | ||
| 4 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
| 5 | using System.Runtime.InteropServices; | 4 | using System.Runtime.InteropServices; |
| 6 | using System.Text; | 5 | using System.Text; |
| 7 | -using System; | ||
| 8 | 6 | ||
| 9 | namespace SherpaOnnx | 7 | namespace SherpaOnnx |
| 10 | { | 8 | { |
| @@ -186,4 +184,4 @@ namespace SherpaOnnx | @@ -186,4 +184,4 @@ namespace SherpaOnnx | ||
| 186 | [DllImport(Dll.Filename)] | 184 | [DllImport(Dll.Filename)] |
| 187 | private static extern void SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers(IntPtr names); | 185 | private static extern void SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers(IntPtr names); |
| 188 | } | 186 | } |
| 189 | -} | ||
| 187 | +} |
| 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; | 1 | +/// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) |
| 7 | using System; | 2 | using System; |
| 3 | +using System.Runtime.InteropServices; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 11 | public class SpeechSegment | 7 | public class SpeechSegment |
| 12 | { | 8 | { |
| 13 | - public SpeechSegment(IntPtr handle) | ||
| 14 | - { | 9 | + public SpeechSegment(IntPtr handle) |
| 10 | + { | ||
| 15 | Impl impl = (Impl)Marshal.PtrToStructure(handle, typeof(Impl)); | 11 | Impl impl = (Impl)Marshal.PtrToStructure(handle, typeof(Impl)); |
| 16 | 12 | ||
| 17 | _start = impl.Start; | 13 | _start = impl.Start; |
| @@ -28,20 +24,20 @@ namespace SherpaOnnx | @@ -28,20 +24,20 @@ namespace SherpaOnnx | ||
| 28 | } | 24 | } |
| 29 | } | 25 | } |
| 30 | } | 26 | } |
| 31 | - } | 27 | + } |
| 32 | 28 | ||
| 33 | - public int _start; | ||
| 34 | - public int Start => _start; | 29 | + public int _start; |
| 30 | + public int Start => _start; | ||
| 35 | 31 | ||
| 36 | - private float[] _samples; | ||
| 37 | - public float[] Samples => _samples; | 32 | + private float[] _samples; |
| 33 | + public float[] Samples => _samples; | ||
| 38 | 34 | ||
| 39 | - [StructLayout(LayoutKind.Sequential)] | ||
| 40 | - struct Impl | ||
| 41 | - { | ||
| 42 | - public int Start; | ||
| 43 | - public IntPtr Samples; | ||
| 44 | - public int Count; | ||
| 45 | - } | 35 | + [StructLayout(LayoutKind.Sequential)] |
| 36 | + struct Impl | ||
| 37 | + { | ||
| 38 | + public int Start; | ||
| 39 | + public IntPtr Samples; | ||
| 40 | + public int Count; | ||
| 41 | + } | ||
| 46 | } | 42 | } |
| 47 | } | 43 | } |
| 1 | -/// Copyright (c) 2024.5 by 东风破 | ||
| 2 | - | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | -using System.Runtime.InteropServices; | ||
| 6 | -using System.Text; | 1 | +/// Copyright (c) 2024.5 by 东风破 |
| 7 | using System; | 2 | using System; |
| 3 | +using System.Runtime.InteropServices; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| @@ -68,4 +64,4 @@ namespace SherpaOnnx | @@ -68,4 +64,4 @@ namespace SherpaOnnx | ||
| 68 | [DllImport(Dll.Filename)] | 64 | [DllImport(Dll.Filename)] |
| 69 | private static extern void SherpaOnnxDestroySpokenLanguageIdentificationResult(IntPtr handle); | 65 | private static extern void SherpaOnnxDestroySpokenLanguageIdentificationResult(IntPtr handle); |
| 70 | } | 66 | } |
| 71 | -} | ||
| 67 | +} |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 1 | -/// Copyright (c) 2024.5 by 东风破 | ||
| 2 | - | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | 1 | +/// Copyright (c) 2024.5 by 东风破 |
| 2 | +using System; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | using System.Text; | 4 | using System.Text; |
| 7 | -using System; | ||
| 8 | 5 | ||
| 9 | namespace SherpaOnnx | 6 | namespace SherpaOnnx |
| 10 | { | 7 | { |
| @@ -43,4 +40,4 @@ namespace SherpaOnnx | @@ -43,4 +40,4 @@ namespace SherpaOnnx | ||
| 43 | private String _lang; | 40 | private String _lang; |
| 44 | public String Lang => _lang; | 41 | public String Lang => _lang; |
| 45 | } | 42 | } |
| 46 | -} | ||
| 43 | +} |
| 1 | /// Copyright (c) 2024.5 by 东风破 | 1 | /// Copyright (c) 2024.5 by 东风破 |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 1 | /// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) | 1 | /// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) |
| 2 | 2 | ||
| 3 | -using System.Linq; | ||
| 4 | -using System.Collections.Generic; | ||
| 5 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
| 6 | -using System.Text; | ||
| 7 | -using System; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| 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; | 1 | +/// Copyright (c) 2024 Xiaomi Corporation (authors: Fangjun Kuang) |
| 7 | using System; | 2 | using System; |
| 3 | +using System.Runtime.InteropServices; | ||
| 8 | 4 | ||
| 9 | namespace SherpaOnnx | 5 | namespace SherpaOnnx |
| 10 | { | 6 | { |
| @@ -112,4 +108,3 @@ namespace SherpaOnnx | @@ -112,4 +108,3 @@ namespace SherpaOnnx | ||
| 112 | 108 | ||
| 113 | } | 109 | } |
| 114 | } | 110 | } |
| 115 | - |
scripts/dotnet/examples/Common.csproj
0 → 100644
| 1 | +<Project Sdk="Microsoft.NET.Sdk"> | ||
| 2 | + | ||
| 3 | + <PropertyGroup> | ||
| 4 | + <TargetFramework>.net6</TargetFramework> | ||
| 5 | + </PropertyGroup> | ||
| 6 | + | ||
| 7 | + <ItemGroup> | ||
| 8 | + <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 9 | + <PackageReference Include="org.k2fsa.sherpa.onnx" Version="1.10.1" /> | ||
| 10 | + </ItemGroup> | ||
| 11 | + | ||
| 12 | +</Project> |
| @@ -8,13 +8,8 @@ | @@ -8,13 +8,8 @@ | ||
| 8 | <Nullable>enable</Nullable> | 8 | <Nullable>enable</Nullable> |
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | - <PropertyGroup> | ||
| 12 | - <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | ||
| 13 | - </PropertyGroup> | ||
| 14 | - | ||
| 15 | <ItemGroup> | 11 | <ItemGroup> |
| 16 | - <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 17 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 18 | </ItemGroup> | 13 | </ItemGroup> |
| 19 | 14 | ||
| 20 | </Project> | 15 | </Project> |
| 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> | 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 | + <ProjectReference Include="..\Common\Common.csproj" /> | ||
| 13 | + </ItemGroup> | ||
| 14 | + | ||
| 15 | +</Project> |
| @@ -8,14 +8,12 @@ | @@ -8,14 +8,12 @@ | ||
| 8 | <Nullable>enable</Nullable> | 8 | <Nullable>enable</Nullable> |
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | - <PropertyGroup> | ||
| 12 | - <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | ||
| 13 | - </PropertyGroup> | ||
| 14 | - | ||
| 15 | <ItemGroup> | 11 | <ItemGroup> |
| 16 | - <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 17 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | ||
| 18 | <PackageReference Include="PortAudioSharp2" Version="*" /> | 12 | <PackageReference Include="PortAudioSharp2" Version="*" /> |
| 19 | </ItemGroup> | 13 | </ItemGroup> |
| 20 | 14 | ||
| 15 | + <ItemGroup> | ||
| 16 | + <ProjectReference Include="..\Common\Common.csproj" /> | ||
| 17 | + </ItemGroup> | ||
| 18 | + | ||
| 21 | </Project> | 19 | </Project> |
| @@ -8,13 +8,8 @@ | @@ -8,13 +8,8 @@ | ||
| 8 | <Nullable>enable</Nullable> | 8 | <Nullable>enable</Nullable> |
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | - <PropertyGroup> | ||
| 12 | - <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | ||
| 13 | - </PropertyGroup> | ||
| 14 | - | ||
| 15 | <ItemGroup> | 11 | <ItemGroup> |
| 16 | - <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 17 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 18 | </ItemGroup> | 13 | </ItemGroup> |
| 19 | 14 | ||
| 20 | </Project> | 15 | </Project> |
| @@ -8,14 +8,8 @@ | @@ -8,14 +8,8 @@ | ||
| 8 | <Nullable>enable</Nullable> | 8 | <Nullable>enable</Nullable> |
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | - | ||
| 12 | - <PropertyGroup> | ||
| 13 | - <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | ||
| 14 | - </PropertyGroup> | ||
| 15 | - | ||
| 16 | <ItemGroup> | 11 | <ItemGroup> |
| 17 | - <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 18 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 19 | </ItemGroup> | 13 | </ItemGroup> |
| 20 | 14 | ||
| 21 | </Project> | 15 | </Project> |
| @@ -8,12 +8,8 @@ | @@ -8,12 +8,8 @@ | ||
| 8 | <Nullable>enable</Nullable> | 8 | <Nullable>enable</Nullable> |
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | - <PropertyGroup> | ||
| 12 | - <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | ||
| 13 | - </PropertyGroup> | ||
| 14 | - | ||
| 15 | <ItemGroup> | 11 | <ItemGroup> |
| 16 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 17 | </ItemGroup> | 13 | </ItemGroup> |
| 18 | 14 | ||
| 19 | </Project> | 15 | </Project> |
| @@ -8,14 +8,12 @@ | @@ -8,14 +8,12 @@ | ||
| 8 | <Nullable>enable</Nullable> | 8 | <Nullable>enable</Nullable> |
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | - <PropertyGroup> | ||
| 12 | - <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | ||
| 13 | - </PropertyGroup> | ||
| 14 | - | ||
| 15 | <ItemGroup> | 11 | <ItemGroup> |
| 16 | - <PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
| 17 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | ||
| 18 | <PackageReference Include="PortAudioSharp2" Version="*" /> | 12 | <PackageReference Include="PortAudioSharp2" Version="*" /> |
| 19 | </ItemGroup> | 13 | </ItemGroup> |
| 20 | 14 | ||
| 15 | + <ItemGroup> | ||
| 16 | + <ProjectReference Include="..\Common\Common.csproj" /> | ||
| 17 | + </ItemGroup> | ||
| 18 | + | ||
| 21 | </Project> | 19 | </Project> |
| @@ -8,12 +8,8 @@ | @@ -8,12 +8,8 @@ | ||
| 8 | <Nullable>enable</Nullable> | 8 | <Nullable>enable</Nullable> |
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | - <PropertyGroup> | ||
| 12 | - <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | ||
| 13 | - </PropertyGroup> | ||
| 14 | - | ||
| 15 | <ItemGroup> | 11 | <ItemGroup> |
| 16 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 17 | </ItemGroup> | 13 | </ItemGroup> |
| 18 | 14 | ||
| 19 | </Project> | 15 | </Project> |
| @@ -8,12 +8,8 @@ | @@ -8,12 +8,8 @@ | ||
| 8 | <Nullable>enable</Nullable> | 8 | <Nullable>enable</Nullable> |
| 9 | </PropertyGroup> | 9 | </PropertyGroup> |
| 10 | 10 | ||
| 11 | - <PropertyGroup> | ||
| 12 | - <RestoreSources>/tmp/packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | ||
| 13 | - </PropertyGroup> | ||
| 14 | - | ||
| 15 | <ItemGroup> | 11 | <ItemGroup> |
| 16 | - <PackageReference Include="org.k2fsa.sherpa.onnx" Version="*" /> | 12 | + <ProjectReference Include="..\Common\Common.csproj" /> |
| 17 | </ItemGroup> | 13 | </ItemGroup> |
| 18 | 14 | ||
| 19 | </Project> | 15 | </Project> |
| 1 | -<Project Sdk="Microsoft.NET.Sdk"> | ||
| 2 | - | ||
| 3 | - <PropertyGroup> | ||
| 4 | - <OutputType>Exe</OutputType> | ||
| 5 | - <TargetFramework>net6.0</TargetFramework> | ||
| 6 | - <RootNamespace>vad_non_streaming_asr_paraformer</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> | 1 | +<Project Sdk="Microsoft.NET.Sdk"> |
| 2 | + | ||
| 3 | + <PropertyGroup> | ||
| 4 | + <OutputType>Exe</OutputType> | ||
| 5 | + <TargetFramework>net6.0</TargetFramework> | ||
| 6 | + <RootNamespace>vad_non_streaming_asr_paraformer</RootNamespace> | ||
| 7 | + <ImplicitUsings>enable</ImplicitUsings> | ||
| 8 | + <Nullable>enable</Nullable> | ||
| 9 | + </PropertyGroup> | ||
| 10 | + | ||
| 11 | + <ItemGroup> | ||
| 12 | + <ProjectReference Include="..\Common\Common.csproj" /> | ||
| 13 | + </ItemGroup> | ||
| 14 | + | ||
| 15 | +</Project> |
-
请 注册 或 登录 后发表评论