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,7 +219,9 @@ std::string OfflineRecognitionResult::AsJsonString() const {
nlohmann::json j; nlohmann::json j;
j["text"] = text; j["text"] = text;
j["tokens"] = tokens; j["tokens"] = tokens;
#if 1
// This branch chooses number of decimal points to keep in
// the return json string
std::ostringstream os; std::ostringstream os;
os << "["; os << "[";
std::string sep = ""; std::string sep = "";
@@ -228,10 +230,10 @@ std::string OfflineRecognitionResult::AsJsonString() const {
sep = ", "; sep = ", ";
} }
os << "]"; 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(); j["timestamps"] = os.str();
#else
j["timestamps"] = timestamps;
#endif
return j.dump(); return j.dump();
} }

View File

@@ -72,7 +72,7 @@ struct OnlineRecognizerConfig {
EndpointConfig endpoint_config; EndpointConfig endpoint_config;
bool enable_endpoint = true; 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 // now support modified_beam_search and greedy_search
int32_t max_active_paths = 4; // used only for modified_beam_search int32_t max_active_paths = 4; // used only for modified_beam_search