A Scanner searches for a phrase, or multiple phrases, in the decoded audio.
For WORD scans, the most likely decoded hypothesis is searched.
For LATTICE scans, all possibilities in the client.lattice.Lattice are searched.
When a callback is provided, it will be called for each match found. Arguments passed are the Scanner object, the phrase found, the containing Utterance and the start time of the matching phrase. For LATTICE scans, an additional argument, the confidence score of the matching phrase, will be passed to the callback.
Scans can be performed on active streams or previously decoded data and can be paused, resumed and closed.
Continuously scan decoded words for given phrase(s) and when match is found, call callback with (Scanner, phrase, time, Utterance). If no callback is supplied, then defaults to printing matches and is blocking.
Return newly created Scanner object.
Continuously scan whole decoded lattice for given phrase(s). When match is found, call callback with (Scanner, phrase, time, Utterance, confidence). If no callback is supplied, then defaults to printing matches and is blocking.
Returns newly created Scanner object.
Continuously scan source for given stype target(s) and when match is found, call callback. The source type, stype, is either WORD or LATTICE. If no callback is supplied, then defaults to printing matches and is blocking.
Returns newly created Scanner object.
Scans through specified source for given targets.
Constructor creates and starts a scanner with the specified source, stype, targets, and callback. The source is a client.stream.Stream, client.speechdata.SpeechData, or decoded file from client.speechdata.SpeechData.dump(). The source type, stype, is either WORD or LATTICE.
targets is the phrase or list of phrases for which to scan. A phrase is a space delimited string of one or more words.
callback is the function to be called when matches occur. For WORD scans, called with (Scanner, target, time, Utterance). For LATTICE scans, called with (Scanner, target, time, Utterance, confidence). When scan is done, will be called with None for non-Scanner fields.