@@ -20,7 +20,7 @@ namespace sherpa_onnx {
20
20
21
21
// / Helper for `OnlineRecognizerResult::AsJsonString()`
22
22
template <typename T>
23
- const std::string& VecToString (const std::vector<T>& vec, int32_t precision = 6 ) {
23
+ std::string VecToString (const std::vector<T>& vec, int32_t precision = 6 ) {
24
24
std::ostringstream oss;
25
25
oss << std::fixed << std::setprecision (precision);
26
26
oss << " [ " ;
@@ -35,9 +35,8 @@ const std::string& VecToString(const std::vector<T>& vec, int32_t precision = 6)
35
35
36
36
// / Helper for `OnlineRecognizerResult::AsJsonString()`
37
37
template <> // explicit specialization for T = std::string
38
- const std::string& VecToString<std::string>(const std::vector<std::string>& vec,
39
- int32_t ) // ignore 2nd arg
40
- {
38
+ std::string VecToString<std::string>(const std::vector<std::string>& vec,
39
+ int32_t ) { // ignore 2nd arg
41
40
std::ostringstream oss;
42
41
oss << " [ " ;
43
42
std::string sep = " " ;
@@ -57,9 +56,10 @@ std::string OnlineRecognizerResult::AsJsonString() const {
57
56
os << " \" timestamps\" : " << VecToString (timestamps, 2 ) << " , " ;
58
57
os << " \" ys_probs\" : " << VecToString (ys_probs, 6 ) << " , " ;
59
58
os << " \" lm_probs\" : " << VecToString (lm_probs, 6 ) << " , " ;
60
- os << " \" constext_scores \" : " << VecToString (context_scores, 6 ) << " , " ;
59
+ os << " \" context_scores \" : " << VecToString (context_scores, 6 ) << " , " ;
61
60
os << " \" segment\" : " << segment << " , " ;
62
- os << " \" start_time\" : " << std::fixed << std::setprecision (2 ) << start_time << " , " ;
61
+ os << " \" start_time\" : " << std::fixed << std::setprecision (2 )
62
+ << start_time << " , " ;
63
63
os << " \" is_final\" : " << (is_final ? " true" : " false" );
64
64
os << " }" ;
65
65
return os.str ();
0 commit comments