Fangjun Kuang
Committed by GitHub

Minor fixes (#161)

@@ -219,19 +219,21 @@ std::string OfflineRecognitionResult::AsJsonString() const { @@ -219,19 +219,21 @@ std::string OfflineRecognitionResult::AsJsonString() const {
219 nlohmann::json j; 219 nlohmann::json j;
220 j["text"] = text; 220 j["text"] = text;
221 j["tokens"] = tokens; 221 j["tokens"] = tokens;
222 - 222 +#if 1
  223 + // This branch chooses number of decimal points to keep in
  224 + // the return json string
223 std::ostringstream os; 225 std::ostringstream os;
224 os << "["; 226 os << "[";
225 std::string sep = ""; 227 std::string sep = "";
226 for (auto t : timestamps) { 228 for (auto t : timestamps) {
227 os << sep << std::fixed << std::setprecision(2) << t; 229 os << sep << std::fixed << std::setprecision(2) << t;
228 - sep = ","; 230 + sep = ", ";
229 } 231 }
230 os << "]"; 232 os << "]";
231 -  
232 - // NOTE: We don't use j["timestamps"] = timestamps;  
233 - // because we need to control the number of decimal points to keep  
234 j["timestamps"] = os.str(); 233 j["timestamps"] = os.str();
  234 +#else
  235 + j["timestamps"] = timestamps;
  236 +#endif
235 237
236 return j.dump(); 238 return j.dump();
237 } 239 }
@@ -72,7 +72,7 @@ struct OnlineRecognizerConfig { @@ -72,7 +72,7 @@ struct OnlineRecognizerConfig {
72 EndpointConfig endpoint_config; 72 EndpointConfig endpoint_config;
73 bool enable_endpoint = true; 73 bool enable_endpoint = true;
74 74
75 - std::string decoding_method = "modified_beam_search"; 75 + std::string decoding_method = "greedy_search";
76 // now support modified_beam_search and greedy_search 76 // now support modified_beam_search and greedy_search
77 77
78 int32_t max_active_paths = 4; // used only for modified_beam_search 78 int32_t max_active_paths = 4; // used only for modified_beam_search