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-05-22 16:52:38 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2023-05-22 16:52:38 +0800
Commit
44821ae2fb2c3feff3e131a002c5db9c4cb0a089
44821ae2
1 parent
b70d40f4
Use fixed decimal point for offline timestamp (#158)
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
15 行增加
和
2 行删除
sherpa-onnx/csrc/offline-stream.cc
sherpa-onnx/csrc/offline-stream.cc
查看文件 @
44821ae
...
...
@@ -8,8 +8,9 @@
#include <algorithm>
#include <cmath>
#include "nlohmann/json.hpp"
#include "kaldi-native-fbank/csrc/online-feature.h"
#include "nlohmann/json.hpp"
#include "sherpa-onnx/csrc/macros.h"
#include "sherpa-onnx/csrc/offline-recognizer.h"
#include "sherpa-onnx/csrc/resample.h"
...
...
@@ -218,7 +219,19 @@ std::string OfflineRecognitionResult::AsJsonString() const {
nlohmann
::
json
j
;
j
[
"text"
]
=
text
;
j
[
"tokens"
]
=
tokens
;
j
[
"timestamps"
]
=
timestamps
;
std
::
ostringstream
os
;
os
<<
"["
;
std
::
string
sep
=
""
;
for
(
auto
t
:
timestamps
)
{
os
<<
sep
<<
std
::
fixed
<<
std
::
setprecision
(
2
)
<<
t
;
sep
=
","
;
}
os
<<
"]"
;
// NOTE: We don't use j["timestamps"] = timestamps;
// because we need to control the number of decimal points to keep
j
[
"timestamps"
]
=
os
.
str
();
return
j
.
dump
();
}
...
...
请
注册
或
登录
后发表评论