Skip to content

Iterators

Use these keys with forEach to loop over lists of values. The values for these settings refer to runtime instances of code objects and are not serialized by save or dup.

The results and iterators available in the loop functions vary by iterator. See the descriptions below for details on what these are.

Iterators are available only in the events listed, except for those marked as all, which you can use outside of event callbacks too.

Use iterators to do model introspection (e.g. vocab-iterator) or to obtain finer-grained results, such as word-level alignments an scores available with word-iterator.

enrollment-iterator

iterator handle write-only

#define SNSR_ENROLLMENT_LIST "enrollment-iterator"
public class Snsr {
  public final static String ENROLLMENT_LIST = "enrollment-iterator";
}

Iterate over all wake word enrollments for the current user.

This can be used to retrieve enrollment audio if save-enroll-audio is enabled.

all

audio-stream, audio-stream-first, audio-stream-last, begin-sample, end-sample, enrollment-id, user

none

save-enroll-audio, user, user-iterator

model-iterator

iterator handle write-only

#define SNSR_MODEL_LIST "model-iterator"
public class Snsr {
  public final static String MODEL_LIST = "model-iterator";
}

Iterate over the phoneme parts in a result.

^result

begin-ms, begin-sample, end-ms, end-sample, score, text

none

^phone-iterator, word-iterator

nlu-entity-iterator

iterator handle write-only tnl stt

#define SNSR_NLU_ENTITY_LIST "nlu-entity-iterator"
public class Snsr {
  public final static String NLU_ENTITY_LIST = "nlu-entity-iterator";
}

Iterate over NLU entities in the current intent.

This iterator invokes the specified handler for each of the nlu-entity-count entities found for the current intent.

^nlu-intent

nlu-entity-count, nlu-entity-name, nlu-entity-score, nlu-entity-value

none

nlu-entity-count

nlu-slot-iterator

iterator handle write-only tnl stt

#define SNSR_NLU_SLOT_LIST "nlu-slot-iterator"
public class Snsr {
  public final static String NLU_SLOT_LIST = "nlu-slot-iterator";
}

Iterate over NLU child result slots.

This iterator invokes the specified handler for each of the NLU result slots found in the current NLU slot value, nlu-slot-value.

^nlu-slot

nlu-slot-count, nlu-slot-name, nlu-slot-score, nlu-slot-value

nlu-slot-iterator

nlu-word-iterator

iterator handle write-only tnl stt

#define SNSR_NLU_WORD_LIST "nlu-word-iterator"
public class Snsr {
  public final static String NLU_WORD_LIST = "nlu-word-iterator";
}

Iterate over the words in an NLU result.

Valid only for LVCSR recognizers that include NLU post-processing. This post-processing can insert, delete, or change words in the recognition result and those changes are available here.

^nlu-intent, ^nlu-slot

begin-ms, begin-sample, end-ms, end-sample, score, text

none

word-iterator

operating-point-iterator

iterator handle write-only

#define SNSR_OPERATING_POINT_LIST "operating-point-iterator"
public class Snsr {
  public final static String OPERATING_POINT_LIST = "operating-point-iterator";
}

Iterate over available spotter operating points.

all

available-point

none

phone-iterator

iterator handle write-only

#define SNSR_PHONE_LIST "phone-iterator"
public class Snsr {
  public final static String PHONE_LIST = "phone-iterator";
}

Iterate over the phonemes in a result.

STT models do not report any sub-word unit hypotheses.

^result, ^result-partial

begin-ms, begin-sample, end-ms, end-sample, score, text

none

word-iterator

phrase-iterator

iterator handle write-only

#define SNSR_PHRASE_LIST "phrase-iterator"
public class Snsr {
  public final static String PHRASE_LIST = "phrase-iterator";
}

Iterate over recognition phrase hypotheses.

Most recognizers provide only the top-scoring recognition result. phrase-iterator is useful only when an LVCSR recognizer is configured to provide N-best results; when result-max > 1.

^result

begin-ms, begin-sample, end-ms, end-sample, score, text

none

result-max

reason-iterator

iterator handle write-only

#define SNSR_REASON_LIST "reason-iterator"
public class Snsr {
  public final static String REASON_LIST = "reason-iterator";
}

Iterate over all reasons for wake word enrollment failure.

^fail

reason, reason-guidance, reason-pass, reason-threshold, reason-value

none

user-iterator

iterator handle write-only

#define SNSR_USER_LIST "user-iterator"
public class Snsr {
  public final static String USER_LIST = "user-iterator";
}

Iterate over all enrolled users.

Sets user to each of the enrolled users before invoking the callback.

all

enrollment-count, user

none

vocab-iterator

iterator handle write-only

#define SNSR_VOCAB_LIST "vocab-iterator"
public class Snsr {
  public final static String VOCAB_LIST = "vocab-iterator";
}

Iterate over the vocabulary available in a keyword spotter.

all

id, text

none

word-iterator

iterator handle write-only

#define SNSR_WORD_LIST "word-iterator"
public class Snsr {
  public final static String WORD_LIST = "word-iterator";
}

Iterate over the words in a result.

User-defined enrolled results are modeled as a single word.

^result, ^result-partial

begin-ms, begin-sample, end-ms, end-sample, score, text

none