Skip to content

Commit f5f800c

Browse files
committed
Store partial result as well
1 parent 9976001 commit f5f800c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

res-speech-vosk/res_speech_vosk.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ static int vosk_recog_write(struct ast_speech *speech, void *data, int len)
166166
struct ast_json *res_json = ast_json_load_string(res, &err);
167167
if (res_json != NULL) {
168168
const char *text = ast_json_object_string_get(res_json, "text");
169-
if (text != NULL && !ast_strlen_zero(text)) {
169+
const char *partial = ast_json_object_string_get(res_json, "partial");
170+
if (partial != NULL && !ast_strlen_zero(partial)) {
171+
ast_log(LOG_NOTICE, "(%s) Partial recognition result: %s\n", vosk_speech->name, partial);
172+
ast_free(vosk_speech->last_result);
173+
vosk_speech->last_result = ast_strdup(partial);
174+
} else if (text != NULL && !ast_strlen_zero(text)) {
170175
ast_log(LOG_NOTICE, "(%s) Recognition result: %s\n", vosk_speech->name, text);
171176
ast_free(vosk_speech->last_result);
172177
vosk_speech->last_result = ast_strdup(text);

0 commit comments

Comments
 (0)