//
// CVSpeechRecognizer.h
// CeedVocal SDK
//
// Created by Raphael Sebbe on May 20th 2008.
// Copyright 2008-2014 Creaceed sprl. All rights reserved.
//

#import

@class CVSpeechRecognizer;

typedef enum
{
    CV_ISOLATED_PHRASES = 0, // default mode, only the provided phrases will be recognized
    CV_KEYWORD_SPOTTING = 1,// same as isolated phrases but a garbage model is provided, words are recognized in the stream of speech
} CVRecognitionMode;

typedef enum CVRecognitionLanguage
{
    CV_LANGUAGE_ENGLISH=0,
    CV_LANGUAGE_FRENCH=1,
    CV_LANGUAGE_SPANISH=2,
    CV_LANGUAGE_GERMAN=3,
    CV_LANGUAGE_DUTCH=4,
    CV_LANGUAGE_ITALIAN=5
} CVRecognitionLanguage;

@interface NSObject (CVSpeechRecognizerDelegation)
// these methods are invoked directly from the audio thread, you should return as fast as possible.
- (void)speechRecognizerDidReceiveAudioBuffer: (const int16_t*)buf sampleCount:(uint32_t)count;
- (void)speechRecognizerDidStartProcessingSpeech: (CVSpeechRecognizer*)recognizer;
- (void)speechRecognizerDidRecognizeSpeech: (CVSpeechRecognizer*)recognizer;
@end

struct CVSpeechRecognizerPrivateData;

@interface CVSpeechRecognizer : NSObject {
struct CVSpeechRecognizerPrivateData *_privateData;
}

// ------ Readwrite properties
@property (readwrite, assign) id delegate;
@property (readwrite) uint32_t numberOfRequestedResults;
@property (readwrite)BOOLvibratesWhenReady;
//@property (readwrite)SystemSoundID readySound, doneSound;

// ------ Readonly properties
@property (readonly) BOOL recognitionStarted;
// tells how much audio / speech has been going through this recognizer (audio / speech). 0 on init, then always increasing
@property (readonly) float audioStreamDuration;
@property (readonly) float speechStreamDuration;

+ (void)setLicense:(NSString*)license;
+ (void)terminateAudioQueue;

// ------ Creating a new recognizer
- (CVSpeechRecognizer*)initWithLanguage: (CVRecognitionLanguage)lang acousticModel:(NSString*)modelpath;
- (CVSpeechRecognizer*)initWithLanguage: (CVRecognitionLanguage)lang acousticModel:(NSString*)modelpath mode:(CVRecognitionMode)mode;

// ------ Isolated Phrases Recognition
- (void)removeAllPhrases;
- (void)addPhrase: (NSString*)phrase;
- (void)addPhrases: (NSArray*)phrases;

// ------ These two are only valid within speechRecognizerDidRecognizeSpeech: delegate method
- (NSArray*)recognizedPhrases;
- (float)scoreForRecognizedPhrase:(NSString*)phrase;

// ------ Recognizer Setup
- (void)prepareRecognizer;
- (void)startRecognition;
- (void)stopRecognition;
- (void)terminateRecognizer;

- (void)flush;

@end



More information is available on GitHub.
En | Fr | De | Nl | Es | It