diff --git a/sherpa-onnx/csrc/offline-stream.cc b/sherpa-onnx/csrc/offline-stream.cc index 5284abf4..a84a15a9 100644 --- a/sherpa-onnx/csrc/offline-stream.cc +++ b/sherpa-onnx/csrc/offline-stream.cc @@ -219,19 +219,21 @@ std::string OfflineRecognitionResult::AsJsonString() const { nlohmann::json j; j["text"] = text; j["tokens"] = tokens; - +#if 1 + // This branch chooses number of decimal points to keep in + // the return json string std::ostringstream os; os << "["; std::string sep = ""; for (auto t : timestamps) { os << sep << std::fixed << std::setprecision(2) << t; - sep = ","; + 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(); +#else + j["timestamps"] = timestamps; +#endif return j.dump(); } diff --git a/sherpa-onnx/csrc/online-recognizer.h b/sherpa-onnx/csrc/online-recognizer.h index f2427ed3..136fb820 100644 --- a/sherpa-onnx/csrc/online-recognizer.h +++ b/sherpa-onnx/csrc/online-recognizer.h @@ -72,7 +72,7 @@ struct OnlineRecognizerConfig { EndpointConfig endpoint_config; bool enable_endpoint = true; - std::string decoding_method = "modified_beam_search"; + std::string decoding_method = "greedy_search"; // now support modified_beam_search and greedy_search int32_t max_active_paths = 4; // used only for modified_beam_search