PocketSphinx  0.6
ps_lattice.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* ====================================================================
3  * Copyright (c) 2008 Carnegie Mellon University. All rights
4  * reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  *
18  * This work was supported in part by funding from the Defense Advanced
19  * Research Projects Agency and the National Science Foundation of the
20  * United States of America, and the CMU Sphinx Speech Consortium.
21  *
22  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
23  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
26  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  * ====================================================================
35  *
36  */
37 
42 #ifndef __PS_LATTICE_H__
43 #define __PS_LATTICE_H__
44 
45 /* SphinxBase headers. */
46 #include <sphinxbase/prim_type.h>
47 #include <sphinxbase/ngram_model.h>
48 
49 /* PocketSphinx headers. */
50 #include <pocketsphinx_export.h>
51 
55 typedef struct ps_lattice_s ps_lattice_t;
56 
63 typedef struct ps_latnode_s ps_latnode_t;
64 
68 typedef struct ps_latnode_s ps_latnode_iter_t; /* pay no attention to the man behind the curtain */
69 
76 typedef struct ps_latlink_s ps_latlink_t;
77 
82 
83 /* Forward declaration needed to avoid circular includes */
84 struct ps_decoder_s;
85 
93 POCKETSPHINX_EXPORT
95  char const *file);
96 
106 POCKETSPHINX_EXPORT
108 
114 POCKETSPHINX_EXPORT
115 int ps_lattice_free(ps_lattice_t *dag);
116 
122 POCKETSPHINX_EXPORT
123 int ps_lattice_write(ps_lattice_t *dag, char const *filename);
124 
130 POCKETSPHINX_EXPORT
131 int ps_lattice_write_htk(ps_lattice_t *dag, char const *filename);
132 
141 POCKETSPHINX_EXPORT
142 logmath_t *ps_lattice_get_logmath(ps_lattice_t *dag);
143 
144 
154 POCKETSPHINX_EXPORT
156 
162 POCKETSPHINX_EXPORT
164 
169 POCKETSPHINX_EXPORT
171 
175 POCKETSPHINX_EXPORT
177 
186 POCKETSPHINX_EXPORT
187 int ps_latnode_times(ps_latnode_t *node, int16 *out_fef, int16 *out_lef);
188 
196 POCKETSPHINX_EXPORT
197 char const *ps_latnode_word(ps_lattice_t *dag, ps_latnode_t *node);
198 
206 POCKETSPHINX_EXPORT
207 char const *ps_latnode_baseword(ps_lattice_t *dag, ps_latnode_t *node);
208 
215 POCKETSPHINX_EXPORT
217 
224 POCKETSPHINX_EXPORT
226 
238 POCKETSPHINX_EXPORT
239 int32 ps_latnode_prob(ps_lattice_t *dag, ps_latnode_t *node,
240  ps_latlink_t **out_link);
241 
248 POCKETSPHINX_EXPORT
250 
255 POCKETSPHINX_EXPORT
257 
261 POCKETSPHINX_EXPORT
263 
274 POCKETSPHINX_EXPORT
275 int ps_latlink_times(ps_latlink_t *link, int16 *out_sf);
276 
284 POCKETSPHINX_EXPORT
286 
294 POCKETSPHINX_EXPORT
295 char const *ps_latlink_word(ps_lattice_t *dag, ps_latlink_t *link);
296 
304 POCKETSPHINX_EXPORT
305 char const *ps_latlink_baseword(ps_lattice_t *dag, ps_latlink_t *link);
306 
313 POCKETSPHINX_EXPORT
315 
326 POCKETSPHINX_EXPORT
327 int32 ps_latlink_prob(ps_lattice_t *dag, ps_latlink_t *link, int32 *out_ascr);
328 
333 POCKETSPHINX_EXPORT
335  int32 score, int32 ef);
336 
352 POCKETSPHINX_EXPORT
354 
362 POCKETSPHINX_EXPORT
364 
375 POCKETSPHINX_EXPORT
377 
385 POCKETSPHINX_EXPORT
387 
396 POCKETSPHINX_EXPORT
397 ps_latlink_t *ps_lattice_bestpath(ps_lattice_t *dag, ngram_model_t *lmset,
398  float32 lwf, float32 ascale);
399 
407 POCKETSPHINX_EXPORT
408 int32 ps_lattice_posterior(ps_lattice_t *dag, ngram_model_t *lmset,
409  float32 ascale);
410 
422 POCKETSPHINX_EXPORT
423 int32 ps_lattice_posterior_prune(ps_lattice_t *dag, int32 beam);
424 
425 #ifdef NOT_IMPLEMENTED_YET
426 
432 POCKETSPHINX_EXPORT
433 int32 ps_lattice_ngram_expand(ps_lattice_t *dag, ngram_model_t *lm);
434 #endif
435 
442 POCKETSPHINX_EXPORT
444 
445 #endif /* __PS_LATTICE_H__ */