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
Emmanuel Schmidbauer
2024-08-16 19:21:59 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2024-08-17 07:21:59 +0800
Commit
8c087d9110c24bb8574770783f3d13af53c740fd
8c087d91
1 parent
88809753
flutter: add lang, emotion, event to OfflineRecognizerResult (#1268)
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
21 行增加
和
4 行删除
flutter/sherpa_onnx/lib/src/offline_recognizer.dart
flutter/sherpa_onnx/lib/src/offline_recognizer.dart
查看文件 @
8c087d9
...
...
@@ -186,16 +186,24 @@ class OfflineRecognizerConfig {
class
OfflineRecognizerResult
{
OfflineRecognizerResult
(
{
required
this
.
text
,
required
this
.
tokens
,
required
this
.
timestamps
});
{
required
this
.
text
,
required
this
.
tokens
,
required
this
.
timestamps
,
required
this
.
lang
,
required
this
.
emotion
,
required
this
.
event
});
@override
String
toString
()
{
return
'OfflineRecognizerResult(text:
$text
, tokens:
$tokens
, timestamps:
$timestamps
)'
;
return
'OfflineRecognizerResult(text:
$text
, tokens:
$tokens
, timestamps:
$timestamps
, lang:
$lang
, emotion:
$emotion
, event:
$event
)'
;
}
final
String
text
;
final
List
<
String
>
tokens
;
final
List
<
double
>
timestamps
;
final
String
lang
;
final
String
emotion
;
final
String
event
;
}
class
OfflineRecognizer
{
...
...
@@ -319,7 +327,13 @@ class OfflineRecognizer {
SherpaOnnxBindings
.
getOfflineStreamResultAsJson
?.
call
(
stream
.
ptr
)
??
nullptr
;
if
(
json
==
nullptr
)
{
return
OfflineRecognizerResult
(
text:
''
,
tokens:
[],
timestamps:
[]);
return
OfflineRecognizerResult
(
text:
''
,
tokens:
[],
timestamps:
[],
lang:
''
,
emotion:
''
,
event:
''
);
}
final
parsedJson
=
jsonDecode
(
toDartString
(
json
));
...
...
@@ -329,7 +343,10 @@ class OfflineRecognizer {
return
OfflineRecognizerResult
(
text:
parsedJson
[
'text'
],
tokens:
List
<
String
>.
from
(
parsedJson
[
'tokens'
]),
timestamps:
List
<
double
>.
from
(
parsedJson
[
'timestamps'
]));
timestamps:
List
<
double
>.
from
(
parsedJson
[
'timestamps'
]),
lang:
parsedJson
[
'lang'
],
emotion:
parsedJson
[
'emotion'
],
event:
parsedJson
[
'event'
]);
}
Pointer
<
SherpaOnnxOfflineRecognizer
>
ptr
;
...
...
请
注册
或
登录
后发表评论