Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2023-07-02 22:57:48 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-07-02 22:57:48 +0800
Commit
2c436606bdf6474eb803b97d521ed564da7b6e0b
2c436606
1 parent
0dd2d41f
Support .Netstandard 2.0 (#193)
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
43 行增加
和
6 行删除
CMakeLists.txt
scripts/dotnet/offline.cs
scripts/dotnet/online.cs
scripts/dotnet/sherpa-onnx.csproj.in
scripts/dotnet/sherpa-onnx.csproj.runtime.in
CMakeLists.txt
查看文件 @
2c43660
cmake_minimum_required
(
VERSION 3.13 FATAL_ERROR
)
project
(
sherpa-onnx
)
set
(
SHERPA_ONNX_VERSION
"1.4.
7
"
)
set
(
SHERPA_ONNX_VERSION
"1.4.
8
"
)
# Disable warning about
#
...
...
scripts/dotnet/offline.cs
查看文件 @
2c43660
...
...
@@ -4,6 +4,7 @@
using
System.Linq
;
using
System.Collections.Generic
;
using
System.Runtime.InteropServices
;
using
System.Text
;
using
System
;
namespace
SherpaOnnx
...
...
@@ -116,7 +117,25 @@ namespace SherpaOnnx
public
OfflineRecognizerResult
(
IntPtr
handle
)
{
Impl
impl
=
(
Impl
)
Marshal
.
PtrToStructure
(
handle
,
typeof
(
Impl
));
_text
=
Marshal
.
PtrToStringUTF8
(
impl
.
Text
);
// PtrToStringUTF8() requires .net standard 2.1
// _text = Marshal.PtrToStringUTF8(impl.Text);
int
length
=
0
;
unsafe
{
byte
*
buffer
=
(
byte
*)
impl
.
Text
;
while
(*
buffer
!=
0
)
{
++
buffer
;
}
length
=
(
int
)(
buffer
-
(
byte
*)
impl
.
Text
);
}
byte
[]
stringBuffer
=
new
byte
[
length
];
Marshal
.
Copy
(
impl
.
Text
,
stringBuffer
,
0
,
length
);
_text
=
Encoding
.
UTF8
.
GetString
(
stringBuffer
);
}
[
StructLayout
(
LayoutKind
.
Sequential
)]
...
...
scripts/dotnet/online.cs
查看文件 @
2c43660
/// Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang)
/// Copyright (c) 2023 by manyeyes
using
System.Linq
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Runtime.InteropServices
;
using
System.Text
;
using
System
;
namespace
SherpaOnnx
...
...
@@ -116,7 +117,24 @@ namespace SherpaOnnx
public
OnlineRecognizerResult
(
IntPtr
handle
)
{
Impl
impl
=
(
Impl
)
Marshal
.
PtrToStructure
(
handle
,
typeof
(
Impl
));
_text
=
Marshal
.
PtrToStringUTF8
(
impl
.
Text
);
// PtrToStringUTF8() requires .net standard 2.1
// _text = Marshal.PtrToStringUTF8(impl.Text);
int
length
=
0
;
unsafe
{
byte
*
buffer
=
(
byte
*)
impl
.
Text
;
while
(*
buffer
!=
0
)
{
++
buffer
;
}
length
=
(
int
)(
buffer
-
(
byte
*)
impl
.
Text
);
}
byte
[]
stringBuffer
=
new
byte
[
length
];
Marshal
.
Copy
(
impl
.
Text
,
stringBuffer
,
0
,
length
);
_text
=
Encoding
.
UTF8
.
GetString
(
stringBuffer
);
}
[
StructLayout
(
LayoutKind
.
Sequential
)]
...
...
scripts/dotnet/sherpa-onnx.csproj.in
查看文件 @
2c43660
...
...
@@ -4,7 +4,7 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<OutputType>Library</OutputType>
<LangVersion>10.0</LangVersion>
<TargetFrameworks>netstandard2.
1
;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.
0
;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;osx-x64;win-x64</RuntimeIdentifiers>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>sherpa-onnx</AssemblyName>
...
...
scripts/dotnet/sherpa-onnx.csproj.runtime.in
查看文件 @
2c43660
...
...
@@ -3,7 +3,7 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<OutputType>Library</OutputType>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net6.0
;net7.0
</TargetFrameworks>
<RuntimeIdentifier>{{ dotnet_rid }}</RuntimeIdentifier>
<AssemblyName>sherpa-onnx</AssemblyName>
<Version>{{ version }}</Version>
...
...
请
注册
或
登录
后发表评论