PocketSphinx  5.0.0rc5
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 
43 #ifndef __PS_LATTICE_H__
44 #define __PS_LATTICE_H__
45 
46 #include <pocketsphinx/prim_type.h>
47 #include <pocketsphinx/model.h>
48 #include <pocketsphinx/export.h>
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 #if 0
54 }
55 #endif
56 
61 typedef struct ps_lattice_s ps_lattice_t;
62 
70 typedef struct ps_latnode_s ps_latnode_t;
71 
76 typedef struct ps_latnode_s ps_latnode_iter_t; /* pay no attention to the man behind the curtain */
77 
85 typedef struct ps_latlink_s ps_latlink_t;
86 
91 typedef struct latlink_list_s ps_latlink_iter_t;
92 
93 /* Forward declaration needed to avoid circular includes */
94 struct ps_decoder_s;
95 
103 POCKETSPHINX_EXPORT
104 ps_lattice_t *ps_lattice_read(struct ps_decoder_s *ps,
105  char const *file);
106 
116 POCKETSPHINX_EXPORT
118 
124 POCKETSPHINX_EXPORT
125 int ps_lattice_free(ps_lattice_t *dag);
126 
132 POCKETSPHINX_EXPORT
133 int ps_lattice_write(ps_lattice_t *dag, char const *filename);
134 
140 POCKETSPHINX_EXPORT
141 int ps_lattice_write_htk(ps_lattice_t *dag, char const *filename);
142 
151 POCKETSPHINX_EXPORT
153 
154 
164 POCKETSPHINX_EXPORT
166 
172 POCKETSPHINX_EXPORT
174 
179 POCKETSPHINX_EXPORT
181 
185 POCKETSPHINX_EXPORT
187 
196 POCKETSPHINX_EXPORT
197 int ps_latnode_times(ps_latnode_t *node, int16 *out_fef, int16 *out_lef);
198 
206 POCKETSPHINX_EXPORT
207 char const *ps_latnode_word(ps_lattice_t *dag, ps_latnode_t *node);
208 
216 POCKETSPHINX_EXPORT
217 char const *ps_latnode_baseword(ps_lattice_t *dag, ps_latnode_t *node);
218 
225 POCKETSPHINX_EXPORT
227 
234 POCKETSPHINX_EXPORT
236 
248 POCKETSPHINX_EXPORT
249 int32 ps_latnode_prob(ps_lattice_t *dag, ps_latnode_t *node,
250  ps_latlink_t **out_link);
251 
258 POCKETSPHINX_EXPORT
260 
265 POCKETSPHINX_EXPORT
267 
271 POCKETSPHINX_EXPORT
273 
284 POCKETSPHINX_EXPORT
285 int ps_latlink_times(ps_latlink_t *link, int16 *out_sf);
286 
294 POCKETSPHINX_EXPORT
296 
304 POCKETSPHINX_EXPORT
305 char const *ps_latlink_word(ps_lattice_t *dag, ps_latlink_t *link);
306 
314 POCKETSPHINX_EXPORT
315 char const *ps_latlink_baseword(ps_lattice_t *dag, ps_latlink_t *link);
316 
323 POCKETSPHINX_EXPORT
325 
336 POCKETSPHINX_EXPORT
337 int32 ps_latlink_prob(ps_lattice_t *dag, ps_latlink_t *link, int32 *out_ascr);
338 
343 POCKETSPHINX_EXPORT
345  int32 score, int32 ef);
346 
362 POCKETSPHINX_EXPORT
364 
372 POCKETSPHINX_EXPORT
374 
385 POCKETSPHINX_EXPORT
387 
395 POCKETSPHINX_EXPORT
397 
406 POCKETSPHINX_EXPORT
408  float32 lwf, float32 ascale);
409 
417 POCKETSPHINX_EXPORT
419  float32 ascale);
420 
432 POCKETSPHINX_EXPORT
433 int32 ps_lattice_posterior_prune(ps_lattice_t *dag, int32 beam);
434 
435 #ifdef NOT_IMPLEMENTED_YET
436 
442 POCKETSPHINX_EXPORT
443 int32 ps_lattice_ngram_expand(ps_lattice_t *dag, ngram_model_t *lm);
444 #endif
445 
452 POCKETSPHINX_EXPORT
454 
455 #ifdef __cplusplus
456 }
457 #endif
458 
459 #endif /* __PS_LATTICE_H__ */
logmath_t
struct logmath_s logmath_t
Definition: logmath.h:106
prim_type.h
Basic type definitions used in Sphinx.
ps_lattice_traverse_next
POCKETSPHINX_EXPORT ps_latlink_t * ps_lattice_traverse_next(ps_lattice_t *dag, ps_latnode_t *end)
model.h
Public API for language models.
ps_latlink_baseword
POCKETSPHINX_EXPORT const char * ps_latlink_baseword(ps_lattice_t *dag, ps_latlink_t *link)
ps_latnode_iter_node
POCKETSPHINX_EXPORT ps_latnode_t * ps_latnode_iter_node(ps_latnode_iter_t *itor)
ps_latnode_iter
POCKETSPHINX_EXPORT ps_latnode_iter_t * ps_latnode_iter(ps_lattice_t *dag)
ps_latnode_baseword
POCKETSPHINX_EXPORT const char * ps_latnode_baseword(ps_lattice_t *dag, ps_latnode_t *node)
ps_latnode_times
POCKETSPHINX_EXPORT int ps_latnode_times(ps_latnode_t *node, int16 *out_fef, int16 *out_lef)
ps_latnode_iter_next
POCKETSPHINX_EXPORT ps_latnode_iter_t * ps_latnode_iter_next(ps_latnode_iter_t *itor)
ps_latnode_word
POCKETSPHINX_EXPORT const char * ps_latnode_word(ps_lattice_t *dag, ps_latnode_t *node)
ps_latnode_iter_t
Iterator over DAG nodes.
ps_latlink_iter_free
POCKETSPHINX_EXPORT void ps_latlink_iter_free(ps_latlink_iter_t *itor)
ps_lattice_write_htk
POCKETSPHINX_EXPORT int ps_lattice_write_htk(ps_lattice_t *dag, char const *filename)
ps_latnode_prob
POCKETSPHINX_EXPORT int32 ps_latnode_prob(ps_lattice_t *dag, ps_latnode_t *node, ps_latlink_t **out_link)
ps_latlink_prob
POCKETSPHINX_EXPORT int32 ps_latlink_prob(ps_lattice_t *dag, ps_latlink_t *link, int32 *out_ascr)
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_latlink_nodes
POCKETSPHINX_EXPORT ps_latnode_t * ps_latlink_nodes(ps_latlink_t *link, ps_latnode_t **out_src)
ps_lattice_bestpath
POCKETSPHINX_EXPORT ps_latlink_t * ps_lattice_bestpath(ps_lattice_t *dag, ngram_model_t *lmset, float32 lwf, float32 ascale)
ps_lattice_t
Word graph structure used in bestpath/nbest search.
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_latlink_iter_link
POCKETSPHINX_EXPORT ps_latlink_t * ps_latlink_iter_link(ps_latlink_iter_t *itor)
ps_latlink_times
POCKETSPHINX_EXPORT int ps_latlink_times(ps_latlink_t *link, int16 *out_sf)
ps_latlink_iter_next
POCKETSPHINX_EXPORT ps_latlink_iter_t * ps_latlink_iter_next(ps_latlink_iter_t *itor)
ps_lattice_posterior_prune
POCKETSPHINX_EXPORT int32 ps_lattice_posterior_prune(ps_lattice_t *dag, int32 beam)
ps_lattice_free
POCKETSPHINX_EXPORT int ps_lattice_free(ps_lattice_t *dag)
ps_lattice_write
POCKETSPHINX_EXPORT int ps_lattice_write(ps_lattice_t *dag, char const *filename)
ps_latnode_iter_free
POCKETSPHINX_EXPORT void ps_latnode_iter_free(ps_latnode_iter_t *itor)
ps_lattice_n_frames
POCKETSPHINX_EXPORT int ps_lattice_n_frames(ps_lattice_t *dag)
ps_latlink_word
POCKETSPHINX_EXPORT const char * ps_latlink_word(ps_lattice_t *dag, ps_latlink_t *link)
ps_lattice_get_logmath
POCKETSPHINX_EXPORT logmath_t * ps_lattice_get_logmath(ps_lattice_t *dag)
ngram_model_t
N-Gram based language model.
ps_lattice_reverse_next
POCKETSPHINX_EXPORT ps_latlink_t * ps_lattice_reverse_next(ps_lattice_t *dag, ps_latnode_t *start)
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_latnode_t
Node in a word lattice.
ps_latlink_pred
POCKETSPHINX_EXPORT ps_latlink_t * ps_latlink_pred(ps_latlink_t *link)
ps_latnode_exits
POCKETSPHINX_EXPORT ps_latlink_iter_t * ps_latnode_exits(ps_latnode_t *node)
ps_lattice_read
POCKETSPHINX_EXPORT ps_lattice_t * ps_lattice_read(struct ps_decoder_s *ps, char const *file)
ps_lattice_retain
POCKETSPHINX_EXPORT ps_lattice_t * ps_lattice_retain(ps_lattice_t *dag)
ps_latnode_entries
POCKETSPHINX_EXPORT ps_latlink_iter_t * ps_latnode_entries(ps_latnode_t *node)
ps_lattice_posterior
POCKETSPHINX_EXPORT int32 ps_lattice_posterior(ps_lattice_t *dag, ngram_model_t *lmset, float32 ascale)