1/*---------------------------------------------------------------------------* 2 * SR_RecognizerResultImpl.h * 3 * * 4 * Copyright 2007, 2008 Nuance Communciations, Inc. * 5 * * 6 * Licensed under the Apache License, Version 2.0 (the 'License'); * 7 * you may not use this file except in compliance with the License. * 8 * * 9 * You may obtain a copy of the License at * 10 * http://www.apache.org/licenses/LICENSE-2.0 * 11 * * 12 * Unless required by applicable law or agreed to in writing, software * 13 * distributed under the License is distributed on an 'AS IS' BASIS, * 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 15 * See the License for the specific language governing permissions and * 16 * limitations under the License. * 17 * * 18 *---------------------------------------------------------------------------*/ 19 20#ifndef __SR_RECOGNIZERRESULTIMPL_H 21#define __SR_RECOGNIZERRESULTIMPL_H 22 23 24 25#include <string.h> 26#include "ESR_ReturnCode.h" 27#include "ArrayList.h" 28#include "HashMap.h" 29#include "SR_RecognizerImpl.h" 30 31 32#include "simapi.h" 33 34/** 35 * RecognitionResult implementation. 36 */ 37typedef struct SR_RecognizerResultImpl_t 38{ 39 /** 40 * Interface functions that must be implemented. 41 */ 42 SR_RecognizerResult Interface; 43 44 /** 45 * N-best list. 46 */ 47 CA_NBestList* nbestList; 48 /** 49 * Size of n-best list. 50 */ 51 size_t nbestListSize; 52 53 /** 54 * Locale of grammar that produced this result 55 */ 56 ESR_Locale locale; 57 58 /** 59 * Pointer to regognizer which owns this object. 60 */ 61 SR_RecognizerImpl* recogImpl; 62 63 /** 64 * N-best list. ArrayList of ArrayLists of SR_SemanticResult. 65 * The first ArrayList denotes the nbest-list. 66 * The second ArrayList denotes the collection of semantic results per nbest list entry. 67 */ 68 ArrayList* results; 69} 70SR_RecognizerResultImpl; 71 72/** 73 * Create a new recognizer result. 74 * 75 * @param self RecognizerResult handle 76 */ 77SREC_RECOGNIZER_API ESR_ReturnCode SR_RecognizerResult_Create(SR_RecognizerResult** self, SR_RecognizerImpl* recogImpl); 78/** 79 * Default implementation. 80 */ 81SREC_RECOGNIZER_API ESR_ReturnCode SR_RecognizerResult_GetWaveform(const SR_RecognizerResult* self, 82 const asr_int16_t** waveform, 83 size_t* size); 84/** 85 * Default implementation. 86 */ 87SREC_RECOGNIZER_API ESR_ReturnCode SR_RecognizerResult_GetSize(const SR_RecognizerResult* self, 88 size_t* resultSize); 89/** 90 * Default implementation. 91 */ 92SREC_RECOGNIZER_API ESR_ReturnCode SR_RecognizerResult_GetKeyCount(const SR_RecognizerResult* self, 93 const size_t nbest, 94 size_t* count); 95/** 96 * Default implementation. 97 */ 98SREC_RECOGNIZER_API ESR_ReturnCode SR_RecognizerResult_GetKeyList(const SR_RecognizerResult* self, 99 const size_t nbest, 100 LCHAR** list, 101 size_t* listSize); 102/** 103 * Default implementation. 104 */ 105SREC_RECOGNIZER_API ESR_ReturnCode SR_RecognizerResult_GetValue(const SR_RecognizerResult* self, 106 const size_t nbest, 107 const LCHAR* key, 108 LCHAR* value, 109 size_t* len); 110/** 111 * Default implementation. 112 */ 113SREC_RECOGNIZER_API ESR_ReturnCode SR_RecognizerResult_GetLocale(const SR_RecognizerResult* self, 114 ESR_Locale* locale); 115 116 117/** 118 * Default implementation. 119 */ 120SREC_RECOGNIZER_API ESR_ReturnCode SR_RecognizerResult_Destroy(SR_RecognizerResult* self); 121 122#endif /* __SR_RECOGNIZERRESULTIMPL_H */ 123