Skip to content

Commit 5c29e9a

Browse files
author
sowens-csd
committed
feat: fix results JSON for Windows plugin
1 parent 34f4078 commit 5c29e9a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

speech_to_text_windows/windows/speech_to_text_windows_plugin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ void SpeechToTextWindowsPlugin::GetLocales(
331331

332332
void SpeechToTextWindowsPlugin::SendTextRecognition(const std::string& text, bool is_final) {
333333
if (m_channel) {
334-
std::string json_result = "{\"recognizedWords\":\"" + text +
335-
"\",\"finalResult\":" + (is_final ? std::to_string(FINAL_RESULT) : std::to_string(PARTIAL_RESULT)) + "}";
334+
std::string json_result = "{\"alternates\":[{\"recognizedWords\":\"" + text +
335+
"\",\"confidence\":0.85}],\"finalResult\":" + (is_final ? std::to_string(FINAL_RESULT) : std::to_string(PARTIAL_RESULT)) + "}";
336336
std::cout << "Sending to Flutter: " << json_result << std::endl;
337337
m_channel->InvokeMethod("textRecognition",
338338
std::make_unique<flutter::EncodableValue>(json_result));

0 commit comments

Comments
 (0)