NTPocketSphinxRecognizer Class Reference

Inherits from NSObject
Conforms to NTSpeechRecognizer
Declared in NTPocketSphinxRecognizer.h
NTPocketSphinxRecognizer.m

Overview

Speech Recognizer base on the pocketsphinx decoder.

Other Methods

  decoder

The pocketsphinx decoder used to decode data.

@property (nonatomic, strong, readonly) NTPocketSphinxDecoder *decoder

Discussion

The pocketsphinx decoder used to decode data.

Declared In

NTPocketSphinxRecognizer.h

  sampleRate

The sample rate of audio data.

@property (nonatomic) int sampleRate

Discussion

The sample rate of audio data.

Declared In

NTPocketSphinxRecognizer.h

  pauseThreshold

Threshold to detect a pause between utterances in seconds.

@property (nonatomic) CFTimeInterval pauseThreshold

Discussion

Threshold to detect a pause between utterances in seconds.

Declared In

NTPocketSphinxRecognizer.h

– initWithAudioSource:

Creates a new recognizer with a given audio source.

- (instancetype)initWithAudioSource:(NTAudioSource *)audioSource

Parameters

audioSource

Audio Source

Return Value

instance

Discussion

Creates a new recognizer with a given audio source.

Declared In

NTSpeechRecognizer.h

– initWithPocketSphinxDecoder:

- (instancetype)initWithPocketSphinxDecoder:(NTPocketSphinxDecoder *)decoder

– initWithPocketSphinxDecoder:audioSource:

- (instancetype)initWithPocketSphinxDecoder:(NTPocketSphinxDecoder *)decoder audioSource:(NTAudioSource *)audioSource

Other Methods

– init

- (instancetype)init

– dealloc

- (void)dealloc

– start

Start the recognition process.

- (void)start

Discussion

Start the recognition process.

Declared In

NTSpeechRecognizer.h

– stop

Stop the recognition process. Has no effect if the process wasn’t started.

- (void)stop

Discussion

Stop the recognition process. Has no effect if the process wasn’t started.

Declared In

NTSpeechRecognizer.h

– suspend

Suspend the recognition process. Has no effect if the process wasn’t started.

- (void)suspend

Discussion

Suspend the recognition process. Has no effect if the process wasn’t started.

Declared In

NTSpeechRecognizer.h

– resume

Resume the recognition process. Has no effect if the process wasn’t started or wasn’t suspended.

- (void)resume

Discussion

Resume the recognition process. Has no effect if the process wasn’t started or wasn’t suspended.

Declared In

NTSpeechRecognizer.h

– isListening

Current listening state. YES if the recognizer currently is listening for speech. Otherwise NO.

- (BOOL)isListening

Discussion

Current listening state. YES if the recognizer currently is listening for speech. Otherwise NO.

Same as (isStarted && !isSuspended).

Declared In

NTSpeechRecognizer.h

– forceEndUtterance

- (void)forceEndUtterance

– changeActiveSearch:

- (void)changeActiveSearch:(NSString *)name

– decodeData:

- (void)decodeData:(NSData *)data

– resetStateForDecoding

- (void)resetStateForDecoding

– setAudioSource:

The audio source where the recognizer gets input data from.

- (void)setAudioSource:(NTAudioSource *)audioSource

Discussion

The audio source where the recognizer gets input data from.

Declared In

NTSpeechRecognizer.h

– audioSource:didReadData:

- (void)audioSource:(NTAudioSource *)audioSource didReadData:(NSData *)data

– dictionary

The dictionary of the recognizer.

- (NTPronunciationDictionary *)dictionary

Discussion

The dictionary of the recognizer.

Declared In

NTSpeechRecognizer.h

– loadPronunciationDictioanry:

Loads the given dictionary.

- (BOOL)loadPronunciationDictioanry:(NTPronunciationDictionary *)dictionary

Parameters

dictionary

Dictionary

Return Value

YES on succes, NO on failure

Discussion

Loads the given dictionary.

Declared In

NTSpeechRecognizer.h

– addWord:phones:

Add the phones for the given word. Existing phones for the same words won’t be deleted.

- (BOOL)addWord:(NSString *)word phones:(NSString *)phones

Parameters

word

Word (e.g. “Flight”)

phones

Phones (e.g. “F L AY T”)

Return Value

YES on success

Discussion

Add the phones for the given word. Existing phones for the same words won’t be deleted.

@attention Use addWords:(NSDictionary*)words when adding multiple words. So the recognizer doesn’t has to update for every single word.

Declared In

NTSpeechRecognizer.h

– addWord:listOfPhones:

Add multiple phones for the given word. Existing phones for the same words won’t be deleted.

- (BOOL)addWord:(NSString *)word listOfPhones:(NSArray *)listOfPhones

Parameters

word

Word (e.g. “Flight”)

listOfPhones

Array (e.g. [“F L AY T”, “F L EY T”])

Return Value

YES on success

Discussion

Add multiple phones for the given word. Existing phones for the same words won’t be deleted.

@attention Use addWords:(NSDictionary*)words when adding multiple words. So the recognizer doesn’t has to update for every single word.

Declared In

NTSpeechRecognizer.h

– addWords:

Adds words and phones from dictionary.

- (BOOL)addWords:(NSDictionary *)words

Parameters

words

dictionary

Return Value

YES on success

Discussion

Adds words and phones from dictionary.

NSDictionary Format:

@{ @“word” : @[ @“phone a”, @“phone b”, @“phone c”], @“word b” : @[ @“phone ba”, @“phone bb”,] }

Declared In

NTSpeechRecognizer.h

– searches

All searches that are registered in this recognizer.

- (NSArray *)searches

Discussion

All searches that are registered in this recognizer.

Declared In

NTSpeechRecognizer.h

– activeSearch

The search currently is active.

- (NTSpeechSearch *)activeSearch

Discussion

The search currently is active.

Declared In

NTSpeechRecognizer.h

– addSearch:

Adds the given search to the recognizer. If there already is a search with the given name it will be replaced.

- (BOOL)addSearch:(NTSpeechSearch *)search

Parameters

search

Search

Return Value

YES on success, NO on failure

Discussion

Adds the given search to the recognizer. If there already is a search with the given name it will be replaced.

Declared In

NTSpeechRecognizer.h

– removeSearch:

Removes the given search.

- (void)removeSearch:(NTSpeechSearch *)search

Parameters

search

Search

Discussion

Removes the given search.

Declared In

NTSpeechRecognizer.h

– removeSearchByName:

Removes the search with the given name if existing.

- (void)removeSearchByName:(NSString *)name

Parameters

name

Name of the search.

Discussion

Removes the search with the given name if existing.

Declared In

NTSpeechRecognizer.h

– setActiveSearchByName:

Activates the search with the given name if existing.

- (BOOL)setActiveSearchByName:(NSString *)name

Parameters

name

Name of the search.

Return Value

YES if a search is existing with given name, otherwise NO.

Discussion

Activates the search with the given name if existing.

Declared In

NTSpeechRecognizer.h

– searchWithName:

Get the search with the given name, if existing.

- (NTSpeechSearch *)searchWithName:(NSString *)name

Parameters

name

Name to search for.

Return Value

Search if existing, otherwise nil.

Discussion

Get the search with the given name, if existing.

Declared In

NTSpeechRecognizer.h

– notifyHypothesisReceived:

- (void)notifyHypothesisReceived:(NTHypothesis *)hyp

– notifyPartialHypothesisReceived:

- (void)notifyPartialHypothesisReceived:(NTHypothesis *)hyp

– notifyDidChangeListeningState:

- (void)notifyDidChangeListeningState:(BOOL)state

– addDelegate:

Adds a delegate

- (void)addDelegate:(id<NTSpeechRecognizerDelegate>)delegate

Parameters

delegate

delegate

Discussion

Adds a delegate

Declared In

NTSpeechRecognizer.h

– removeDelegate:

Removes a delegate

- (void)removeDelegate:(id<NTSpeechRecognizerDelegate>)delegate

Parameters

delegate

delegate

Discussion

Removes a delegate

Declared In

NTSpeechRecognizer.h

Extension Methods

  decodeQueue

@property (nonatomic) dispatch_queue_t decodeQueue

  timeSinceSilenceStarted

The time is elapsed since the silence began.

@property (nonatomic) CFTimeInterval timeSinceSilenceStarted

Discussion

The time is elapsed since the silence began.

Declared In

NTPocketSphinxRecognizer.m

  utteranceStarted

Whether an utterance was started or not.

@property (nonatomic) BOOL utteranceStarted

Discussion

Whether an utterance was started or not.

Declared In

NTPocketSphinxRecognizer.m

  speechDetectedWithinUtterance

Whether the decoder detected speech during the current utterance.

@property (nonatomic) BOOL speechDetectedWithinUtterance

Discussion

Whether the decoder detected speech during the current utterance.

Declared In

NTPocketSphinxRecognizer.m

  delegates

List of delegates

@property (nonatomic, strong) NSHashTable *delegates

Discussion

List of delegates

Declared In

NTPocketSphinxRecognizer.m