PocketSphinx  5.0.0
A small speech recognizer
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 
46 #ifndef __PS_LATTICE_H__
47 #define __PS_LATTICE_H__
48 
49 #include <pocketsphinx/prim_type.h>
50 #include <pocketsphinx/model.h>
51 #include <pocketsphinx/export.h>
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 #if 0
57 }
58 #endif
59 
64 typedef struct ps_lattice_s ps_lattice_t;
65 
73 typedef struct ps_latnode_s ps_latnode_t;
74 
79 typedef struct ps_latnode_s ps_latnode_iter_t; /* pay no attention to the man behind the curtain */
80 
88 typedef struct ps_latlink_s ps_latlink_t;
89 
94 typedef struct latlink_list_s ps_latlink_iter_t;
95 
96 /* Forward declaration needed to avoid circular includes */
97 struct ps_decoder_s;
98 
107 POCKETSPHINX_EXPORT
108 ps_lattice_t *ps_lattice_read(struct ps_decoder_s *ps,
109  char const *file);
110 
121 POCKETSPHINX_EXPORT
123 
130 POCKETSPHINX_EXPORT
131 int ps_lattice_free(ps_lattice_t *dag);
132 
139 POCKETSPHINX_EXPORT
140 int ps_lattice_write(ps_lattice_t *dag, char const *filename);
141 
148 POCKETSPHINX_EXPORT
149 int ps_lattice_write_htk(ps_lattice_t *dag, char const *filename);
150 
160 POCKETSPHINX_EXPORT
162 
163 
174 POCKETSPHINX_EXPORT
176 
183 POCKETSPHINX_EXPORT
185 
191 POCKETSPHINX_EXPORT
193 
198 POCKETSPHINX_EXPORT
200 
210 POCKETSPHINX_EXPORT
211 int ps_latnode_times(ps_latnode_t *node, int16 *out_fef, int16 *out_lef);
212 
221 POCKETSPHINX_EXPORT
222 char const *ps_latnode_word(ps_lattice_t *dag, ps_latnode_t *node);
223 
232 POCKETSPHINX_EXPORT
233 char const *ps_latnode_baseword(ps_lattice_t *dag, ps_latnode_t *node);
234 
242 POCKETSPHINX_EXPORT
244 
252 POCKETSPHINX_EXPORT
254 
267 POCKETSPHINX_EXPORT
268 int32 ps_latnode_prob(ps_lattice_t *dag, ps_latnode_t *node,
269  ps_latlink_t **out_link);
270 
278 POCKETSPHINX_EXPORT
280 
286 POCKETSPHINX_EXPORT
288 
293 POCKETSPHINX_EXPORT
295 
307 POCKETSPHINX_EXPORT
308 int ps_latlink_times(ps_latlink_t *link, int16 *out_sf);
309 
318 POCKETSPHINX_EXPORT
320 
329 POCKETSPHINX_EXPORT
330 char const *ps_latlink_word(ps_lattice_t *dag, ps_latlink_t *link);
331 
340 POCKETSPHINX_EXPORT
341 char const *ps_latlink_baseword(ps_lattice_t *dag, ps_latlink_t *link);
342 
350 POCKETSPHINX_EXPORT
352 
364 POCKETSPHINX_EXPORT
365 int32 ps_latlink_prob(ps_lattice_t *dag, ps_latlink_t *link, int32 *out_ascr);
366 
373 POCKETSPHINX_EXPORT
375  int32 score, int32 ef);
376 
393 POCKETSPHINX_EXPORT
395 
404 POCKETSPHINX_EXPORT
406 
418 POCKETSPHINX_EXPORT
420 
429 POCKETSPHINX_EXPORT
431 
441 POCKETSPHINX_EXPORT
443  float32 lwf, float32 ascale);
444 
453 POCKETSPHINX_EXPORT
455  float32 ascale);
456 
469 POCKETSPHINX_EXPORT
470 int32 ps_lattice_posterior_prune(ps_lattice_t *dag, int32 beam);
471 
472 #ifdef NOT_IMPLEMENTED_YET
473 
479 POCKETSPHINX_EXPORT
480 int32 ps_lattice_ngram_expand(ps_lattice_t *dag, ngram_model_t *lm);
481 #endif
482 
490 POCKETSPHINX_EXPORT
492 
493 #ifdef __cplusplus
494 }
495 #endif
496 
497 #endif /* __PS_LATTICE_H__ */
ps_latnode_t::ps_latnode_prob
POCKETSPHINX_EXPORT int32 ps_latnode_prob(ps_lattice_t *dag, ps_latnode_t *node, ps_latlink_t **out_link)
ps_lattice_t::ps_lattice_write
POCKETSPHINX_EXPORT int ps_lattice_write(ps_lattice_t *dag, char const *filename)
ps_lattice_t::ps_lattice_reverse_next
POCKETSPHINX_EXPORT ps_latlink_t * ps_lattice_reverse_next(ps_lattice_t *dag, ps_latnode_t *start)
prim_type.h
Basic type definitions used in Sphinx.
model.h
Public API for language models.
ps_lattice_t::ps_lattice_link
POCKETSPHINX_EXPORT void ps_lattice_link(ps_lattice_t *dag, ps_latnode_t *from, ps_latnode_t *to, int32 score, int32 ef)
ps_lattice_t::ps_lattice_posterior_prune
POCKETSPHINX_EXPORT int32 ps_lattice_posterior_prune(ps_lattice_t *dag, int32 beam)
ps_latnode_iter_t::ps_latnode_iter_node
POCKETSPHINX_EXPORT ps_latnode_t * ps_latnode_iter_node(ps_latnode_iter_t *itor)
ps_latnode_t::ps_latnode_baseword
POCKETSPHINX_EXPORT const char * ps_latnode_baseword(ps_lattice_t *dag, ps_latnode_t *node)
ps_lattice_t::ps_lattice_retain
POCKETSPHINX_EXPORT ps_lattice_t * ps_lattice_retain(ps_lattice_t *dag)
ps_latnode_iter_t
Iterator over DAG nodes.
ps_latnode_t::ps_latnode_word
POCKETSPHINX_EXPORT const char * ps_latnode_word(ps_lattice_t *dag, ps_latnode_t *node)
ps_lattice_t::ps_lattice_write_htk
POCKETSPHINX_EXPORT int ps_lattice_write_htk(ps_lattice_t *dag, char const *filename)
ps_lattice_t
Word graph structure used in bestpath/nbest search.
ps_latnode_iter_t::ps_latnode_times
POCKETSPHINX_EXPORT int ps_latnode_times(ps_latnode_t *node, int16 *out_fef, int16 *out_lef)
ps_lattice_t::ps_lattice_reverse_edges
POCKETSPHINX_EXPORT ps_latlink_t * ps_lattice_reverse_edges(ps_lattice_t *dag, ps_latnode_t *start, ps_latnode_t *end)
ps_latnode_iter_t::ps_latnode_iter_free
POCKETSPHINX_EXPORT void ps_latnode_iter_free(ps_latnode_iter_t *itor)
ps_lattice_t::ps_lattice_read
POCKETSPHINX_EXPORT ps_lattice_t * ps_lattice_read(struct ps_decoder_s *ps, char const *file)
ps_lattice_t::ps_lattice_posterior
POCKETSPHINX_EXPORT int32 ps_lattice_posterior(ps_lattice_t *dag, ngram_model_t *lmset, float32 ascale)
ps_latnode_iter_t::ps_latnode_iter_next
POCKETSPHINX_EXPORT ps_latnode_iter_t * ps_latnode_iter_next(ps_latnode_iter_t *itor)
ps_lattice_t::ps_lattice_bestpath
POCKETSPHINX_EXPORT ps_latlink_t * ps_lattice_bestpath(ps_lattice_t *dag, ngram_model_t *lmset, float32 lwf, float32 ascale)
logmath_t
Integer log math computation class.
ps_lattice_t::ps_lattice_n_frames
POCKETSPHINX_EXPORT int ps_lattice_n_frames(ps_lattice_t *dag)
ps_lattice_t::ps_latnode_iter
POCKETSPHINX_EXPORT ps_latnode_iter_t * ps_latnode_iter(ps_lattice_t *dag)
ngram_model_t
N-Gram based language model.
ps_lattice_t::ps_lattice_traverse_next
POCKETSPHINX_EXPORT ps_latlink_t * ps_lattice_traverse_next(ps_lattice_t *dag, ps_latnode_t *end)
ps_latnode_t::ps_latnode_entries
POCKETSPHINX_EXPORT ps_latlink_iter_t * ps_latnode_entries(ps_latnode_t *node)
ps_latnode_t
Node in a word lattice.
ps_lattice_t::ps_lattice_traverse_edges
POCKETSPHINX_EXPORT ps_latlink_t * ps_lattice_traverse_edges(ps_lattice_t *dag, ps_latnode_t *start, ps_latnode_t *end)
ps_lattice_t::ps_lattice_get_logmath
POCKETSPHINX_EXPORT logmath_t * ps_lattice_get_logmath(ps_lattice_t *dag)
ps_latnode_t::ps_latnode_exits
POCKETSPHINX_EXPORT ps_latlink_iter_t * ps_latnode_exits(ps_latnode_t *node)
ps_lattice_t::ps_lattice_free
POCKETSPHINX_EXPORT int ps_lattice_free(ps_lattice_t *dag)