• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*---------------------------------------------------------------------------*
2  *  SR_SemanticProcessor.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_SEMANTICPROCESSOR_H
21 #define __SR_SEMANTICPROCESSOR_H
22 
23 
24 
25 #include "SR_SemprocPrefix.h"
26 #include "SR_SemanticGraph.h"
27 #include "SR_SemanticResult.h"
28 #include "pstdio.h"
29 #include "ptypes.h"
30 #include "ESR_ReturnCode.h"
31 
32 
33 
34 
35 /**
36  * Wrapper for the eScript Semantic Processor Implementation.
37  */
38 typedef struct SR_SemanticProcessor_t
39 {
40   /**
41    * Parse a graph with the processor provided as argument. Store semantic results in the objects pointed to by each
42    * element in the array provided. In other words, each element of the array is a pointer to a SemanticResult object
43    * created (and destroyed) by the caller of the function.
44    * The size of the array must be SWIrecResultData **result_dataindicated in resultCount. If the array is not big enough, ESR_BUFFER_OVERFLOW
45    * is returned with resultCount set to the size required.
46    */
47   ESR_ReturnCode(*checkParse)(struct SR_SemanticProcessor_t* self, SR_SemanticGraph* semgraph, const LCHAR* transcription, SR_SemanticResult** result, size_t* resultCount);
48   /**
49    * Parse a graph with the processor provided as argument. Store semantic results in the objects pointed to by each
50    * element in the array provided. In other words, each element of the array is a pointer to a SemanticResult object
51    * created (and destroyed) by the caller of the function.
52    * The size of the array must be SWIrecResultData **result_dataindicated in resultCount. If the array is not big enough, ESR_BUFFER_OVERFLOW
53    * is returned with resultCount set to the size required.
54    */
55   ESR_ReturnCode(*checkParseByWordID)(struct SR_SemanticProcessor_t* self, SR_SemanticGraph* semgraph, wordID* wordIDs, SR_SemanticResult** result, size_t* resultCount);
56   /**
57    * Frees the memory used by the Semantic Processor.
58    *
59    * @param self SR_SemanticProcessor handle
60    */
61   ESR_ReturnCode(*destroy)(struct SR_SemanticProcessor_t* self);
62 
63   /**
64    * Set a param to be read by Semantic Processor during processing.
65    *
66    * @param self SR_SemanticProcessor handle
67    * @param key The name of the param
68    * @param value The value of the param
69    */
70   ESR_ReturnCode(*setParam)(struct SR_SemanticProcessor_t* self, const LCHAR* key, const LCHAR* value);
71 
72   /**
73    * Flush the internals of the semantic processor
74    *
75    * @param self SR_SemanticProcessor handle
76    */
77   ESR_ReturnCode(*flush)(struct SR_SemanticProcessor_t* self);
78 
79 }
80 SR_SemanticProcessor;
81 
82 
83 /**
84  * Create a new Semantic Processor.
85  *
86  * @param self SR_SemanticProcessor handle
87  */
88 SREC_SEMPROC_API ESR_ReturnCode SR_SemanticProcessorCreate(SR_SemanticProcessor** self);
89 /**
90  * Create a new Semantic Processor.
91  *
92  * @param self SR_SemanticProcessor handle
93  */
94 SREC_SEMPROC_API ESR_ReturnCode SR_SemanticProcessorDestroy(SR_SemanticProcessor* self);
95 /**
96 * Set a param to be read by Semantic Processor during processing.
97 *
98 * @param self SR_SemanticProcessor handle
99 * @param key The name of the param
100 * @param value The value of the param
101 */
102 SREC_SEMPROC_API ESR_ReturnCode SR_SemanticProcessorSetParam(SR_SemanticProcessor* self, const LCHAR* key, const LCHAR* value);
103 /**
104 * Flush the internals of the Semantic Processor
105 *
106 * @param self SR_SemanticProcessor handle
107 */
108 SREC_SEMPROC_API ESR_ReturnCode SR_SemanticProcessorFlush(SR_SemanticProcessor* self);
109 
110 
111 
112 #endif /* __SR_SEMANTICPROCESSOR_H */
113