Get the specified intent.
#include "asr/asrm.h"
const char* asrm_get_intent_field(asr_result_t *result, const char *field, asr_result_tag_t **tag, int *iterator)
The result structure to search.
The field to search for.
The tag entry for the successfully located intent.
The index to start searching from. On return, the index of the successfully located intent.
The asrm_get_intent_field() function returns a reference to the specified intent, field, within one of the specified result's intent entries. If tag is provided, it's set to point to the intent's tag entry, which contains confidence levels, an ID, and possibly millisecond start and end values. If iterator is provided, its value is used as a starting point for scanning for the specified intent. If an intent is found whose key matches field, its index is stored in iterator.
If field is NULL, the entry at the index indicated by iterator is returned. If tag is NULL, no tag information is returned. If iterator is NULL, the index search begins at 0.
value = asrm_get_intent_field (result, "hour", NULL, NULL);
for (i = 0; (value = asrm_get_intent_field(result, "hour", NULL, &i)); ){ printf ("Found hour intent, value = %s\n", value); } -- extract all fields for (i = 0; (value = asrm_get_intent_field(result, NULL, NULL, &i)); ){ printf ("Found hour intent, value = %s\n", value); }
The value of the intent on success; NULL on failure (the intent wasn't found).