Minor fixes (#161)

This commit is contained in:
Fangjun Kuang
2023-05-23 15:57:33 +08:00
committed by GitHub
parent 44821ae2fb
commit d7114da441
2 changed files with 8 additions and 6 deletions

View File

@@ -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();
}

View File

@@ -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