Add VAD + Non-streaming ASR example for JavaScript API. (#1170)
This commit is contained in:
@@ -306,8 +306,7 @@ std::string OfflineRecognitionResult::AsJsonString() const {
|
||||
os << "{";
|
||||
os << "\"text\""
|
||||
<< ": ";
|
||||
os << "\"" << text << "\""
|
||||
<< ", ";
|
||||
os << std::quoted(text) << ", ";
|
||||
|
||||
os << "\""
|
||||
<< "timestamps"
|
||||
@@ -339,7 +338,7 @@ std::string OfflineRecognitionResult::AsJsonString() const {
|
||||
<< "\"";
|
||||
os.flags(oldFlags);
|
||||
} else {
|
||||
os << sep << "\"" << t << "\"";
|
||||
os << sep << std::quoted(t);
|
||||
}
|
||||
sep = ", ";
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ std::string VecToString<std::string>(const std::vector<std::string> &vec,
|
||||
oss << "[";
|
||||
std::string sep = "";
|
||||
for (const auto &item : vec) {
|
||||
oss << sep << "\"" << item << "\"";
|
||||
oss << sep << std::quoted(item);
|
||||
sep = ", ";
|
||||
}
|
||||
oss << "]";
|
||||
@@ -54,9 +54,7 @@ std::string VecToString<std::string>(const std::vector<std::string> &vec,
|
||||
std::string OnlineRecognizerResult::AsJsonString() const {
|
||||
std::ostringstream os;
|
||||
os << "{ ";
|
||||
os << "\"text\": "
|
||||
<< "\"" << text << "\""
|
||||
<< ", ";
|
||||
os << "\"text\": " << std::quoted(text) << ", ";
|
||||
os << "\"tokens\": " << VecToString(tokens) << ", ";
|
||||
os << "\"timestamps\": " << VecToString(timestamps, 2) << ", ";
|
||||
os << "\"ys_probs\": " << VecToString(ys_probs, 6) << ", ";
|
||||
|
||||
Reference in New Issue
Block a user