Minor fixes (#161)
This commit is contained in:
@@ -219,19 +219,21 @@ 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 = "";
|
||||||
for (auto t : timestamps) {
|
for (auto t : timestamps) {
|
||||||
os << sep << std::fixed << std::setprecision(2) << t;
|
os << sep << std::fixed << std::setprecision(2) << t;
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user