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

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 
00278 POCKETSPHINX_EXPORT
00279 int ps_load_dict(ps_decoder_t *ps, char const *dictfile,
00280                  char const *fdictfile, char const *format);
00281 
00291 POCKETSPHINX_EXPORT
00292 int ps_save_dict(ps_decoder_t *ps, char const *dictfile, char const *format);
00293 
00313 POCKETSPHINX_EXPORT
00314 int ps_add_word(ps_decoder_t *ps,
00315                 char const *word,
00316                 char const *phones,
00317                 int update);
00318 
00334 POCKETSPHINX_EXPORT
00335 int ps_decode_raw(ps_decoder_t *ps, FILE *rawfh,
00336                   char const *uttid, long maxsamps);
00337 
00350 POCKETSPHINX_EXPORT
00351 int ps_start_utt(ps_decoder_t *ps, char const *uttid);
00352 
00360 POCKETSPHINX_EXPORT
00361 char const *ps_get_uttid(ps_decoder_t *ps);
00375 POCKETSPHINX_EXPORT
00376 int ps_process_raw(ps_decoder_t *ps,
00377                    int16 const *data,
00378                    size_t n_samples,
00379                    int no_search,
00380                    int full_utt);
00381 
00395 POCKETSPHINX_EXPORT
00396 int ps_process_cep(ps_decoder_t *ps,
00397                    mfcc_t **data,
00398                    int n_frames,
00399                    int no_search,
00400                    int full_utt);
00401 
00415 POCKETSPHINX_EXPORT
00416 int ps_get_n_frames(ps_decoder_t *ps);
00417 
00424 POCKETSPHINX_EXPORT
00425 int ps_end_utt(ps_decoder_t *ps);
00426 
00436 POCKETSPHINX_EXPORT
00437 char const *ps_get_hyp(ps_decoder_t *ps, int32 *out_best_score,
00438                        char const **out_uttid);
00439 
00454 POCKETSPHINX_EXPORT
00455 int32 ps_get_prob(ps_decoder_t *ps, char const **out_uttid);
00456 
00470 POCKETSPHINX_EXPORT
00471 ps_lattice_t *ps_get_lattice(ps_decoder_t *ps);
00472 
00481 POCKETSPHINX_EXPORT
00482 ps_seg_t *ps_seg_iter(ps_decoder_t *ps, int32 *out_best_score);
00483 
00491 POCKETSPHINX_EXPORT
00492 ps_seg_t *ps_seg_next(ps_seg_t *seg);
00493 
00501 POCKETSPHINX_EXPORT
00502 char const *ps_seg_word(ps_seg_t *seg);
00503 
00515 POCKETSPHINX_EXPORT
00516 void ps_seg_frames(ps_seg_t *seg, int *out_sf, int *out_ef);
00517 
00540 POCKETSPHINX_EXPORT
00541 int32 ps_seg_prob(ps_seg_t *seg, int32 *out_ascr, int32 *out_lscr, int32 *out_lback);
00542 
00546 POCKETSPHINX_EXPORT
00547 void ps_seg_free(ps_seg_t *seg);
00548 
00560 POCKETSPHINX_EXPORT
00561 ps_nbest_t *ps_nbest(ps_decoder_t *ps, int sf, int ef,
00562                      char const *ctx1, char const *ctx2);
00563 
00571 POCKETSPHINX_EXPORT 
00572 ps_nbest_t *ps_nbest_next(ps_nbest_t *nbest);
00573 
00581 POCKETSPHINX_EXPORT
00582 char const *ps_nbest_hyp(ps_nbest_t *nbest, int32 *out_score);
00583 
00591 POCKETSPHINX_EXPORT
00592 ps_seg_t *ps_nbest_seg(ps_nbest_t *nbest, int32 *out_score);
00593 
00599 POCKETSPHINX_EXPORT
00600 void ps_nbest_free(ps_nbest_t *nbest);
00601 
00610 POCKETSPHINX_EXPORT
00611 void ps_get_utt_time(ps_decoder_t *ps, double *out_nspeech,
00612                      double *out_ncpu, double *out_nwall);
00613 
00622 POCKETSPHINX_EXPORT
00623 void ps_get_all_time(ps_decoder_t *ps, double *out_nspeech,
00624                      double *out_ncpu, double *out_nwall);
00625 
00639 #ifdef __cplusplus
00640 } /* extern "C" */
00641 #endif
00642 
00643 #endif /* __POCKETSPHINX_H__ */

Generated on Tue Aug 17 2010 for PocketSphinx by  doxygen 1.7.1