1/*---------------------------------------------------------------------------*
2 *  c42mul.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
21
22#ifndef _h_c42mul_
23#define _h_c42mul_
24
25#ifdef SET_RCSID
26static const char c42mul_h[] = "$Id: c42mul.h,v 1.8.6.8 2008/03/07 19:46:58 dahan Exp $";
27#endif
28
29
30#include "prelib.h"
31#include "utteranc.h"
32#include "duk_args.h"
33#include "setting.h"
34#include "srec_sizes.h"
35#include "search_network.h"
36#include "srec.h"
37#include "swimodel.h"
38
39#ifdef __cplusplus
40extern "C"
41{
42#endif
43
44  /*      Exception based error reporting */
45#define SETUP_RETURN(REC)   ((REC)->err_code= setjmp ((REC)->except_buf))
46#define RETURN_ERROR(CODE)  (rec->except_enabled ? longjmp(rec->except_buf, (CODE)) : SERVICE_ERROR(CODE))
47#define SET_ERROR(CODE)     (rec->err_code= CODE)
48
49  /*  Main calls to multi-line recognition
50  */
51  int multi_srec_viterbi(multi_srec *rec,
52                         srec_eos_detector_parms* eosd,
53                         pattern_info *pattern,
54                         utterance_info* utt);
55
56  void multi_srec_get_result(multi_srec *rec);
57  int activate_grammar_for_recognition(multi_srec* rec1, srec_context* context, const char* rule);
58  int clear_grammars_for_recognition(multi_srec* rec1);
59
60  void partial_traceback(multi_srec *rec, pattern_info *pattern,
61                         utterance_info *utt);
62  void begin_recognition(multi_srec *rec, int begin_syn_node);
63  void end_recognition(multi_srec *rec);
64  int  add_acoustic_model_for_recognition(multi_srec* rec, const SWIModel* swimodel);
65  int  clear_acoustic_models_for_recognition(multi_srec* rec);
66
67  void free_recognition(multi_srec *rec);
68  int allocate_recognition(multi_srec *rec,
69                           int viterbi_prune_thresh,
70                           /* score-based pruning threshold - only keep paths within this delta of best cost*/
71                           int max_hmm_tokens,
72                           int max_fsmnode_tokens,
73                           int max_word_tokens,
74                           int max_altword_tokens,
75                           int num_wordends_per_frame,
76                           int max_fsm_nodes,
77                           int max_fsm_arcs,
78                           int max_frames,
79                           int max_model_states,
80                           int max_searches);
81
82  int compare_model_indices(multi_srec *rec1, srec *rec2);
83
84  void reset_utt_ended_in_result(multi_srec *rec, int sil_dur);
85  int  has_utt_ended_in_result(multi_srec *rec);
86
87
88#if DO_STRESS_CALC
89  void get_stress_in_segment(stress_info *stress, fepFramePkt *frmPkt,
90                             int start, int end, int relative_to_pullp);
91#endif
92
93
94  /*  Utterance stuff moved in here
95  */
96  int get_data_frame(preprocessed *predat, utterance_info *utt);
97  int get_utterance_frame(preprocessed *predat, utterance_info *utt);
98  int advance_utterance_frame(utterance_info *utt);
99  int retreat_utterance_frame(utterance_info *utt);
100  int copy_pattern_frame(utterance_info *oututt, preprocessed *prep);
101  void prepare_data_frame(preprocessed *predat);
102  void convert_adjustment_to_imelda(norm_info *norm, preprocessed *prep);
103
104  int inherit_recognition_statistics(utterance_info *utt, multi_srec *recog,
105                                     int norm_dim);
106
107#ifdef __cplusplus
108}
109#endif
110
111#endif
112