• Main Page
  • Related Pages
  • Data Structures
  • Files
  • File List
  • Globals

include/ps_lattice.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
00002 /* ====================================================================
00003  * Copyright (c) 2008 Carnegie Mellon University.  All rights
00004  * reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer. 
00012  *
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in
00015  *    the documentation and/or other materials provided with the
00016  *    distribution.
00017  *
00018  * This work was supported in part by funding from the Defense Advanced 
00019  * Research Projects Agency and the National Science Foundation of the 
00020  * United States of America, and the CMU Sphinx Speech Consortium.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 
00023  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
00024  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00025  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
00026  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00027  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
00028  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
00029  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
00030  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
00031  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00032  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  *
00034  * ====================================================================
00035  *
00036  */
00037 
00042 #ifndef __PS_LATTICE_H__
00043 #define __PS_LATTICE_H__
00044 
00045 /* SphinxBase headers. */
00046 #include <prim_type.h>
00047 #include <ngram_model.h>
00048 
00049 /* PocketSphinx headers. */
00050 #include <pocketsphinx_export.h>
00051 
00055 typedef struct ps_lattice_s ps_lattice_t;
00056 
00063 typedef struct ps_latnode_s ps_latnode_t;
00064 
00068 typedef struct ps_latnode_s ps_latnode_iter_t; /* pay no attention to the man behind the curtain */
00069 
00076 typedef struct ps_latlink_s ps_latlink_t;
00077 
00081 typedef struct latlink_list_s ps_latlink_iter_t;
00082 
00083 /* Forward declaration needed to avoid circular includes */
00084 struct ps_decoder_s;
00085 
00093 POCKETSPHINX_EXPORT
00094 ps_lattice_t *ps_lattice_read(struct ps_decoder_s *ps,
00095                               char const *file);
00096 
00106 POCKETSPHINX_EXPORT
00107 ps_lattice_t *ps_lattice_retain(ps_lattice_t *dag);
00108 
00114 POCKETSPHINX_EXPORT
00115 int ps_lattice_free(ps_lattice_t *dag);
00116 
00122 POCKETSPHINX_EXPORT
00123 int ps_lattice_write(ps_lattice_t *dag, char const *filename);
00124 
00133 POCKETSPHINX_EXPORT
00134 logmath_t *ps_lattice_get_logmath(ps_lattice_t *dag);
00135 
00136 
00146 POCKETSPHINX_EXPORT
00147 ps_latnode_iter_t *ps_latnode_iter(ps_lattice_t *dag);
00148 
00154 POCKETSPHINX_EXPORT
00155 ps_latnode_iter_t *ps_latnode_iter_next(ps_latnode_iter_t *itor);
00156 
00161 POCKETSPHINX_EXPORT
00162 void ps_latnode_iter_free(ps_latnode_iter_t *itor);
00163 
00167 POCKETSPHINX_EXPORT
00168 ps_latnode_t *ps_latnode_iter_node(ps_latnode_iter_t *itor);
00169 
00178 POCKETSPHINX_EXPORT
00179 int ps_latnode_times(ps_latnode_t *node, int16 *out_fef, int16 *out_lef);
00180 
00188 POCKETSPHINX_EXPORT
00189 char const *ps_latnode_word(ps_lattice_t *dag, ps_latnode_t *node);
00190 
00198 POCKETSPHINX_EXPORT
00199 char const *ps_latnode_baseword(ps_lattice_t *dag, ps_latnode_t *node);
00200 
00207 POCKETSPHINX_EXPORT
00208 ps_latlink_iter_t *ps_latnode_exits(ps_latnode_t *node);
00209 
00216 POCKETSPHINX_EXPORT
00217 ps_latlink_iter_t *ps_latnode_entries(ps_latnode_t *node);
00218 
00230 POCKETSPHINX_EXPORT
00231 int32 ps_latnode_prob(ps_lattice_t *dag, ps_latnode_t *node,
00232                       ps_latlink_t **out_link);
00233 
00240 POCKETSPHINX_EXPORT
00241 ps_latlink_iter_t *ps_latlink_iter_next(ps_latlink_iter_t *itor);
00242 
00247 POCKETSPHINX_EXPORT
00248 void ps_latlink_iter_free(ps_latlink_iter_t *itor);
00249 
00253 POCKETSPHINX_EXPORT
00254 ps_latlink_t *ps_latlink_iter_link(ps_latlink_iter_t *itor);
00255 
00266 POCKETSPHINX_EXPORT
00267 int ps_latlink_times(ps_latlink_t *link, int16 *out_sf);
00268 
00276 POCKETSPHINX_EXPORT
00277 ps_latnode_t *ps_latlink_nodes(ps_latlink_t *link, ps_latnode_t **out_src);
00278 
00286 POCKETSPHINX_EXPORT
00287 char const *ps_latlink_word(ps_lattice_t *dag, ps_latlink_t *link);
00288 
00296 POCKETSPHINX_EXPORT
00297 char const *ps_latlink_baseword(ps_lattice_t *dag, ps_latlink_t *link);
00298 
00305 POCKETSPHINX_EXPORT
00306 ps_latlink_t *ps_latlink_pred(ps_latlink_t *link);
00307 
00318 POCKETSPHINX_EXPORT
00319 int32 ps_latlink_prob(ps_lattice_t *dag, ps_latlink_t *link, int32 *out_ascr);
00320 
00325 POCKETSPHINX_EXPORT
00326 void ps_lattice_link(ps_lattice_t *dag, ps_latnode_t *from, ps_latnode_t *to,
00327                      int32 score, int32 ef);
00328 
00344 POCKETSPHINX_EXPORT
00345 ps_latlink_t *ps_lattice_traverse_edges(ps_lattice_t *dag, ps_latnode_t *start, ps_latnode_t *end);
00346 
00354 POCKETSPHINX_EXPORT
00355 ps_latlink_t *ps_lattice_traverse_next(ps_lattice_t *dag, ps_latnode_t *end);
00356 
00367 POCKETSPHINX_EXPORT
00368 ps_latlink_t *ps_lattice_reverse_edges(ps_lattice_t *dag, ps_latnode_t *start, ps_latnode_t *end);
00369 
00377 POCKETSPHINX_EXPORT
00378 ps_latlink_t *ps_lattice_reverse_next(ps_lattice_t *dag, ps_latnode_t *start);
00379 
00388 POCKETSPHINX_EXPORT
00389 ps_latlink_t *ps_lattice_bestpath(ps_lattice_t *dag, ngram_model_t *lmset,
00390                                   float32 lwf, float32 ascale);
00391 
00402 POCKETSPHINX_EXPORT
00403 int32 ps_lattice_posterior(ps_lattice_t *dag, ngram_model_t *lmset,
00404                            float32 ascale);
00405 
00412 POCKETSPHINX_EXPORT
00413 int ps_lattice_n_frames(ps_lattice_t *dag);
00414 
00415 #endif /* __PS_LATTICE_H__ */

Generated on Thu Jan 27 2011 for PocketSphinx by  doxygen 1.7.1