include/pocketsphinx.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset:4; indent-tabs-mode: nil -*- */
00002 /* ====================================================================
00003  * Copyright (c) 1999-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  *
00019  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 
00020  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
00021  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00022  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
00023  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00024  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
00025  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
00026  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
00027  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
00028  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00029  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030  *
00031  * ====================================================================
00032  *
00033  */
00038 #ifndef __POCKETSPHINX_H__
00039 #define __POCKETSPHINX_H__
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 #if 0
00045 }
00046 #endif
00047 
00048 /* System headers we need. */
00049 #include <stdio.h>
00050 
00051 /* SphinxBase headers we need. */
00052 #include <cmd_ln.h>
00053 #include <logmath.h>
00054 #include <fe.h>
00055 #include <feat.h>
00056 #include <ngram_model.h>
00057 
00058 /* PocketSphinx headers (not many of them!) */
00059 #include <pocketsphinx_export.h>
00060 #include <cmdln_macro.h>
00061 #include <ps_lattice.h>
00062 #include <ps_mllr.h>
00063 #include <fsg_set.h>
00064 
00068 typedef struct ps_decoder_s ps_decoder_t;
00069 
00073 typedef struct ps_astar_s ps_nbest_t;
00074 
00078 typedef struct ps_seg_s ps_seg_t;
00079 
00090 POCKETSPHINX_EXPORT
00091 ps_decoder_t *ps_init(cmd_ln_t *config);
00092 
00110 POCKETSPHINX_EXPORT
00111 int ps_reinit(ps_decoder_t *ps, cmd_ln_t *config);
00112 
00119 POCKETSPHINX_EXPORT
00120 arg_t const *ps_args(void);
00121 
00132 POCKETSPHINX_EXPORT
00133 ps_decoder_t *ps_retain(ps_decoder_t *ps);
00134 
00145 POCKETSPHINX_EXPORT
00146 int ps_free(ps_decoder_t *ps);
00147 
00156 POCKETSPHINX_EXPORT
00157 cmd_ln_t *ps_get_config(ps_decoder_t *ps);
00158 
00167 POCKETSPHINX_EXPORT
00168 logmath_t *ps_get_logmath(ps_decoder_t *ps);
00169 
00178 POCKETSPHINX_EXPORT
00179 fe_t *ps_get_fe(ps_decoder_t *ps);
00180 
00189 POCKETSPHINX_EXPORT
00190 feat_t *ps_get_feat(ps_decoder_t *ps);
00191 
00203 POCKETSPHINX_EXPORT
00204 ps_mllr_t *ps_update_mllr(ps_decoder_t *ps, ps_mllr_t *mllr);
00205 
00217 POCKETSPHINX_EXPORT
00218 ngram_model_t *ps_get_lmset(ps_decoder_t *ps);
00219 
00236 POCKETSPHINX_EXPORT
00237 ngram_model_t *ps_update_lmset(ps_decoder_t *ps, ngram_model_t *lmset);
00238 
00248 POCKETSPHINX_EXPORT
00249 fsg_set_t *ps_get_fsgset(ps_decoder_t *ps);
00250 
00261 POCKETSPHINX_EXPORT
00262 fsg_set_t *ps_update_fsgset(ps_decoder_t *ps);
00263 
00283 POCKETSPHINX_EXPORT
00284 int ps_add_word(ps_decoder_t *ps,
00285                 char const *word,
00286                 char const *phones,
00287                 int update);
00288 
00304 POCKETSPHINX_EXPORT
00305 int ps_decode_raw(ps_decoder_t *ps, FILE *rawfh,
00306                   char const *uttid, long maxsamps);
00307 
00320 POCKETSPHINX_EXPORT
00321 int ps_start_utt(ps_decoder_t *ps, char const *uttid);
00322 
00330 POCKETSPHINX_EXPORT
00331 char const *ps_get_uttid(ps_decoder_t *ps);
00345 POCKETSPHINX_EXPORT
00346 int ps_process_raw(ps_decoder_t *ps,
00347                    int16 const *data,
00348                    size_t n_samples,
00349                    int no_search,
00350                    int full_utt);
00351 
00365 POCKETSPHINX_EXPORT
00366 int ps_process_cep(ps_decoder_t *ps,
00367                    mfcc_t **data,
00368                    int n_frames,
00369                    int no_search,
00370                    int full_utt);
00371 
00385 POCKETSPHINX_EXPORT
00386 int ps_get_n_frames(ps_decoder_t *ps);
00387 
00394 POCKETSPHINX_EXPORT
00395 int ps_end_utt(ps_decoder_t *ps);
00396 
00406 POCKETSPHINX_EXPORT
00407 char const *ps_get_hyp(ps_decoder_t *ps, int32 *out_best_score,
00408                        char const **out_uttid);
00409 
00424 POCKETSPHINX_EXPORT
00425 int32 ps_get_prob(ps_decoder_t *ps, char const **out_uttid);
00426 
00440 POCKETSPHINX_EXPORT
00441 ps_lattice_t *ps_get_lattice(ps_decoder_t *ps);
00442 
00451 POCKETSPHINX_EXPORT
00452 ps_seg_t *ps_seg_iter(ps_decoder_t *ps, int32 *out_best_score);
00453 
00461 POCKETSPHINX_EXPORT
00462 ps_seg_t *ps_seg_next(ps_seg_t *seg);
00463 
00471 POCKETSPHINX_EXPORT
00472 char const *ps_seg_word(ps_seg_t *seg);
00473 
00485 POCKETSPHINX_EXPORT
00486 void ps_seg_frames(ps_seg_t *seg, int *out_sf, int *out_ef);
00487 
00510 POCKETSPHINX_EXPORT
00511 int32 ps_seg_prob(ps_seg_t *seg, int32 *out_ascr, int32 *out_lscr, int32 *out_lback);
00512 
00516 POCKETSPHINX_EXPORT
00517 void ps_seg_free(ps_seg_t *seg);
00518 
00530 POCKETSPHINX_EXPORT
00531 ps_nbest_t *ps_nbest(ps_decoder_t *ps, int sf, int ef,
00532                      char const *ctx1, char const *ctx2);
00533 
00541 POCKETSPHINX_EXPORT 
00542 ps_nbest_t *ps_nbest_next(ps_nbest_t *nbest);
00543 
00551 POCKETSPHINX_EXPORT
00552 char const *ps_nbest_hyp(ps_nbest_t *nbest, int32 *out_score);
00553 
00561 POCKETSPHINX_EXPORT
00562 ps_seg_t *ps_nbest_seg(ps_nbest_t *nbest, int32 *out_score);
00563 
00569 POCKETSPHINX_EXPORT
00570 void ps_nbest_free(ps_nbest_t *nbest);
00571 
00580 POCKETSPHINX_EXPORT
00581 void ps_get_utt_time(ps_decoder_t *ps, double *out_nspeech,
00582                      double *out_ncpu, double *out_nwall);
00583 
00592 POCKETSPHINX_EXPORT
00593 void ps_get_all_time(ps_decoder_t *ps, double *out_nspeech,
00594                      double *out_ncpu, double *out_nwall);
00595 
00609 #ifdef __cplusplus
00610 } /* extern "C" */
00611 #endif
00612 
00613 #endif /* __POCKETSPHINX_H__ */

Generated on Mon Jan 24 21:50:15 2011 for PocketSphinx by  doxygen 1.4.7