asrm_get_intent_field()

Get the specified intent.

Synopsis:

#include "asr/asrm.h"
 
const char* asrm_get_intent_field(asr_result_t *result, const char *field, asr_result_tag_t **tag, int *iterator)

Arguments:

result

The result structure to search.

field

The field to search for.

tag

The tag entry for the successfully located intent.

iterator

The index to start searching from. On return, the index of the successfully located intent.

Library:

libasr

Description:

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.

For example, to get the "hour" field:
value = asrm_get_intent_field (result, "hour", NULL, NULL); 
To extract all "hour" fields:
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);
}

Returns:

The value of the intent on success; NULL on failure (the intent wasn't found).