Main Page
Data Structures
Files
File List
Globals
src
libgfsmxl
gfsmxlCascadeLookup.h
Go to the documentation of this file.
1
2
/*=============================================================================*\
3
* File: gfsmxlCascadeLookup.h
4
* Author: Bryan Jurish <moocow.bovine@gmail.com>
5
* Description: finite state machine library: lookup cascade: lookup routines
6
*
7
* Copyright (c) 2007-2011 Bryan Jurish.
8
*
9
* This library is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU Lesser General Public
11
* License as published by the Free Software Foundation; either
12
* version 2.1 of the License, or (at your option) any later version.
13
*
14
* This library is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* Lesser General Public License for more details.
18
*
19
* You should have received a copy of the GNU Lesser General Public
20
* License along with this library; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
*=============================================================================*/
23
28
#ifndef _GFSMXL_CASCADE_LOOKUP_H
29
#define _GFSMXL_CASCADE_LOOKUP_H
30
31
#include <
gfsmxlCascade.h
>
32
#include <
gfsmxlCLCFib.h
>
33
34
/*======================================================================
35
* Types
36
*/
37
39
typedef
struct
gfsmxlCLCFibHeap
gfsmxlFibHeap
;
40
//typedef struct fibheap gfsmxlFibHeap;
41
43
typedef
struct
gfsmxlCascadeLookupBacktrace_
{
44
struct
gfsmxlCascadeLookupConfig_
*
prev
;
45
gfsmLabelId
lo
;
46
gfsmLabelId
hi
;
47
gfsmWeight
aw
;
48
gfsmWeight
fw
;
49
}
gfsmxlCascadeLookupBacktrace
;
50
52
typedef
struct
gfsmxlCascadeLookupConfig_
{
53
gfsmxlCascade
*
csc
;
54
gfsmxlCascadeStateId
qids
;
55
guint32
ipos
;
56
gfsmStateId
oid
;
57
gfsmStateId
rid
;
58
gfsmWeight
w
;
59
gfsmxlCascadeLookupBacktrace
bt
;
60
}
gfsmxlCascadeLookupConfig
;
61
65
typedef
GSList
gfsmxlCascadeLookupConfigList
;
66
70
typedef
GPtrArray
gfsmxlPathArray
;
71
73
typedef
struct
{
74
//
75
//-- user data
76
gfsmxlCascade
*
csc
;
77
gfsmWeight
max_w
;
78
guint
max_paths
;
79
guint
max_ops
;
80
//
81
//-- low-level data
82
gfsmxlFibHeap
*
heap
;
83
GHashTable *
configs
;
84
gfsmAutomaton
*
otrie
;
85
gfsmxlCascadeLookupConfigList
*
finals
;
86
guint
n_ops
;
87
gfsmxlCascadeLookupConfig
heap_neginf
;
88
}
gfsmxlCascadeLookup
;
89
90
91
/*======================================================================
92
* Constants
93
*/
94
extern
const
gfsmxlCascadeLookupBacktrace
gfsmxl_bt_null
;
/*< "empty" backtrace */
95
96
/*======================================================================
97
* Constructors, etc.
98
*/
100
101
103
GFSM_INLINE
104
gfsmxlCascadeLookup
*
gfsmxl_cascade_lookup_new_full
(
gfsmxlCascade
*csc,
gfsmWeight
max_w, guint max_paths, guint max_ops);
105
107
GFSM_INLINE
108
gfsmxlCascadeLookup
*
gfsmxl_cascade_lookup_new
(
void
);
109
114
GFSM_INLINE
115
void
gfsmxl_cascade_lookup_set_cascade
(
gfsmxlCascadeLookup
*cl,
gfsmxlCascade
*csc);
116
118
GFSM_INLINE
119
void
gfsmxl_cascade_lookup_free
(
gfsmxlCascadeLookup
*cl);
120
122
123
/*======================================================================
124
* gfsmxlCascadeLookup API
125
*/
127
128
129
137
gfsmAutomaton
*
gfsmxl_cascade_lookup_nbest
(
gfsmxlCascadeLookup
*cl,
gfsmLabelVector
*input,
gfsmAutomaton
*result);
138
151
gfsmxlPathArray
*
gfsmxl_cascade_lookup_nbest_paths
(
gfsmxlCascadeLookup
*cl,
gfsmLabelVector
*input,
gfsmxlPathArray
*paths);
152
154
155
/*======================================================================
156
* gfsmxlCascadeLookup: Low-level and Debug Utilities
157
*/
159
160
164
void
gfsmxl_cascade_lookup_reset
(
gfsmxlCascadeLookup
*cl);
165
169
GFSM_INLINE
170
gfsmAutomaton
*
gfsmxl_cascade_lookup_nbest_prepare_
(
gfsmxlCascadeLookup
*cl,
gfsmAutomaton
*result);
171
178
GFSM_INLINE
179
gfsmxlCascadeLookupConfig
*
gfsmxl_cascade_lookup_ensure_config
(
gfsmxlCascadeLookup
*cl,
gfsmxlCascadeLookupConfig
*cfg_key);
180
185
void
gfsmxl_cascade_lookup_nbest_search_
(
gfsmxlCascadeLookup
*cl,
gfsmLabelVector
*input);
186
192
void
gfsmxl_cascade_lookup_nbest_backtrace_
(
gfsmxlCascadeLookup
*cl,
193
gfsmxlCascadeLookupConfig
*cfg,
194
gfsmxlCascadeLookupConfig
*nxt,
195
gfsmAutomaton
*result);
196
202
void
gfsmxl_cascade_lookup_nbest_backtrace_path_
(
gfsmxlCascadeLookup
*cl,
203
gfsmxlCascadeLookupConfig
*cfg,
204
gfsmPath
*p);
205
208
gfsmAutomaton
*
gfsmxl_cascade_lookup_nbest_debug
(
gfsmxlCascadeLookup
*cl,
gfsmLabelVector
*input,
gfsmAutomaton
*result);
209
211
212
/*======================================================================
213
* gfsmxlPathList: Low-level utilities
214
*/
216
218
GFSM_INLINE
219
gfsmxlPathArray
*
gfsmxl_patharray_new
(guint n_paths);
220
222
GFSM_INLINE
223
void
gfsmxl_patharray_free
(
gfsmxlPathArray
*paths);
224
226
void
gfsmxl_patharray_clear
(
gfsmxlPathArray
*paths);
227
229
230
/*======================================================================
231
* gfsmxlCascadeLookupConfig: Low-level Utilities
232
*/
234
235
241
GFSM_INLINE
242
int
gfsmxl_cascade_lookup_config_fh_compare
(
gfsmxlCascadeLookupConfig
*lc1,
gfsmxlCascadeLookupConfig
*lc2);
243
247
guint
gfsmxl_cascade_lookup_config_ht_hash
(
gfsmxlCascadeLookupConfig
*lc);
248
252
gboolean
gfsmxl_cascade_lookup_config_ht_equal
(
gfsmxlCascadeLookupConfig
*lc1,
gfsmxlCascadeLookupConfig
*lc2);
253
260
GFSM_INLINE
261
gfsmxlCascadeLookupConfig
*
gfsmxl_cascade_lookup_config_new_full
(
gfsmxlCascade
*csc,
262
gfsmxlCascadeStateId
qids,
263
guint32 ipos,
264
gfsmStateId
oid,
265
gfsmStateId
rid,
266
gfsmWeight
w,
267
gfsmxlCascadeLookupBacktrace
bt
268
);
269
271
GFSM_INLINE
272
gfsmxlCascadeLookupConfig
*
gfsmxl_cascade_lookup_config_new
(
gfsmxlCascadeLookup
*cl);
273
275
GFSM_INLINE
276
void
gfsmxl_cascade_lookup_config_copy
(
gfsmxlCascadeLookupConfig
*dst,
gfsmxlCascadeLookupConfig
*src);
277
281
GFSM_INLINE
282
gfsmxlCascadeLookupConfig
*
gfsmxl_cascade_lookup_config_clone
(
gfsmxlCascadeLookupConfig
*src);
283
287
GFSM_INLINE
288
void
gfsmxl_cascade_lookup_config_free_inline
(
gfsmxlCascadeLookupConfig
*lc);
289
291
void
gfsmxl_cascade_lookup_config_free
(
gfsmxlCascadeLookupConfig
*lc);
292
294
295
/*======================================================================
296
* Low-level: gfsmxlCascadeLookupConfigList
297
*/
299
300
302
void
gfsmxl_cascade_lookup_config_list_free
(
gfsmxlCascadeLookupConfigList
*lcl);
303
305
306
307
/*======================================================================
308
* END
309
*/
310
311
//-- inline definitions
312
#ifdef GFSM_INLINE_ENABLED
313
# include <gfsmxlCascadeLookup.hi>
314
#endif
315
316
#endif
/* _GFSMXL_CASCADE_LOOKUP_H */
Generated on Mon Oct 20 2014 10:48:47 for libgfsmxl by
1.8.1.2