Added tokens, tokens_arr and json for offline recongnizer result (#936)

Co-authored-by: leo <webmaster@360converter.com>
This commit is contained in:
Leo Huang
2024-05-29 12:53:28 +08:00
committed by GitHub
parent a6c9b7986f
commit d45223034c
2 changed files with 65 additions and 7 deletions

View File

@@ -481,7 +481,27 @@ SHERPA_ONNX_API typedef struct SherpaOnnxOfflineRecognizerResult {
// number of entries in timestamps
int32_t count;
// TODO(fangjun): Add more fields
// Pointer to continuous memory which holds string based tokens
// which are separated by \0
const char *tokens;
// a pointer array containing the address of the first item in tokens
const char *const *tokens_arr;
/** Return a json string.
*
* The returned string contains:
* {
* "text": "The recognition result",
* "tokens": [x, x, x],
* "timestamps": [x, x, x],
* "segment": x,
* "start_time": x,
* "is_final": true|false
* }
*/
const char *json;
} SherpaOnnxOfflineRecognizerResult;
/// Get the result of the offline stream.