• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*---------------------------------------------------------------------------*
2  *  SR_VocabularyImpl.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_VOCABULARYIMPL_H
21 #define __SR_VOCABULARYIMPL_H
22 
23 
24 
25 #include <stdlib.h>
26 #include "ESR_ReturnCode.h"
27 #include "HashMap.h"
28 #ifdef USE_TTP
29 #include "SWIslts.h"
30 #endif /* USE_TTP */
31 
32 
33 #include "simapi.h"
34 
35 /**
36  * Vocabulary implementation.
37  */
38 typedef struct SR_VocabularyImpl_t
39 {
40   /**
41    * Interface functions that must be implemented.
42    */
43   SR_Vocabulary Interface;
44   /**
45    * Legacy CREC vocabulary.
46    */
47   LCHAR* filename;
48   CA_Vocab* vocabulary;
49   /**
50    * Vocabulary locale.
51    */
52   ESR_Locale locale;
53   /**
54    * String to identify TTP language associated with locale.
55    */
56   LCHAR *ttp_lang;
57 
58 #ifdef USE_TTP
59   /**
60    * Handle to a TTP engine.
61    */
62   SWIsltsHand hSlts;
63 #endif /* USE_TTP */
64 }
65 SR_VocabularyImpl;
66 
67 
68 /**
69  * Default implementation.
70  */
71 ESR_ReturnCode SR_VocabularyCreateImpl(SR_Vocabulary** self);
72 /**
73  * Default implementation.
74  */
75 ESR_ReturnCode SR_VocabularyLoadImpl(const LCHAR* filename, SR_Vocabulary** self);
76 /**
77  * Default implementation.
78  */
79 ESR_ReturnCode SR_VocabularySaveImpl(SR_Vocabulary* self, const LCHAR* filename);
80 /**
81  * Default implementation.
82  */
83 ESR_ReturnCode SR_VocabularyAddWordImpl(SR_Vocabulary* self, const LCHAR* word);
84 /**
85  * Default implementation.
86  */
87 ESR_ReturnCode SR_VocabularyDeleteWordImpl(SR_Vocabulary* self, const LCHAR* word);
88 /**
89  * Default implementation.
90  */
91 ESR_ReturnCode SR_VocabularyContainsWordImpl(SR_Vocabulary* self, const LCHAR* word, ESR_BOOL* result);
92 /**
93  * Default implementation.
94  */
95 ESR_ReturnCode SR_VocabularyGetPronunciationImpl(SR_Vocabulary* self, const LCHAR* word, LCHAR* phoneme, size_t* len);
96 /**
97  * Default implementation.
98  */
99 ESR_ReturnCode SR_VocabularyGetLanguageImpl(SR_Vocabulary* self, ESR_Locale* locale);
100 /**
101  * Default implementation.
102  */
103 ESR_ReturnCode SR_VocabularyDestroyImpl(SR_Vocabulary* self);
104 /**
105  * Default implementation.
106  */
107 ESR_ReturnCode SR_CreateG2P(SR_Vocabulary* self);
108 /**
109  * Default implementation.
110  */
111 ESR_ReturnCode SR_DestroyG2P(SR_Vocabulary* self);
112 
113 /* TODO change this later if we get other languages to support*/
114 #define TTP_LANG(locale) locale == ESR_LOCALE_EN_US ? L("enu") : \
115                          locale == ESR_LOCALE_FR_FR ? L("fra") : \
116                          locale == ESR_LOCALE_DE_DE ? L("deu") : \
117                          locale == ESR_LOCALE_EN_GB ? L("eng") : \
118                          locale == ESR_LOCALE_JA_JP ? L("jpn") : \
119                          locale == ESR_LOCALE_NL_NL ? L("nln") : \
120                          locale == ESR_LOCALE_IT_IT ? L("ita") : \
121                          locale == ESR_LOCALE_ES_ES ? L("esp") : \
122                          locale == ESR_LOCALE_PT_PT ? L("ptp") : \
123                          L("enu")  /* en-us is default */
124 
125 #endif /* __SR_VOCABULARYIMPL_H */
126