NTUdpFakeRecognizer Class Reference

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

Overview

A recognizer I used for testing and evaluation purposes. It just receives string from a udp connection and posts them as hypotheses.

Other Methods

– initWithPort:

- (instancetype)initWithPort:(UInt16)port

– initWithAudioSource:port:

- (instancetype)initWithAudioSource:(NTAudioSource *)audioSource port:(UInt16)port

Other Methods

– init

- (instancetype)init

– 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

– 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

– 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

– udpSocket:didReceiveData:fromAddress:withFilterContext:

- (void)udpSocket:(GCDAsyncUdpSocket *)sock didReceiveData:(NSData *)data fromAddress:(NSData *)address withFilterContext:(id)filterContext

– 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

  socket

@property (nonatomic, strong) GCDAsyncUdpSocket *socket

  delegates

@property (nonatomic, strong) NSHashTable *delegates

  port

@property (nonatomic) UInt16 port