• Main Page
  • Related Pages
  • 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 <fsg_set.h>
00063 
00067 typedef struct ps_decoder_s ps_decoder_t;
00068 
00072 typedef struct ps_astar_s ps_nbest_t;
00073 
00077 typedef struct ps_seg_s ps_seg_t;
00078 
00089 POCKETSPHINX_EXPORT
00090 ps_decoder_t *ps_init(cmd_ln_t *config);
00091 
00109 POCKETSPHINX_EXPORT
00110 int ps_reinit(ps_decoder_t *ps, cmd_ln_t *config);
00111 
00118 POCKETSPHINX_EXPORT
00119 arg_t const *ps_args(void);
00120 
00131 POCKETSPHINX_EXPORT
00132 ps_decoder_t *ps_retain(ps_decoder_t *ps);
00133 
00144 POCKETSPHINX_EXPORT
00145 int ps_free(ps_decoder_t *ps);
00146 
00155 POCKETSPHINX_EXPORT
00156 cmd_ln_t *ps_get_config(ps_decoder_t *ps);
00157 
00166 POCKETSPHINX_EXPORT
00167 logmath_t *ps_get_logmath(ps_decoder_t *ps);
00168 
00177 POCKETSPHINX_EXPORT
00178 fe_t *ps_get_fe(ps_decoder_t *ps);
00179 
00188 POCKETSPHINX_EXPORT
00189 feat_t *ps_get_feat(ps_decoder_t *ps);
00190 
00202 POCKETSPHINX_EXPORT
00203 ngram_model_t *ps_get_lmset(ps_decoder_t *ps);
00204 
00221 POCKETSPHINX_EXPORT
00222 ngram_model_t *ps_update_lmset(ps_decoder_t *ps, ngram_model_t *lmset);
00223 
00233 POCKETSPHINX_EXPORT
00234 fsg_set_t *ps_get_fsgset(ps_decoder_t *ps);
00235 
00246 POCKETSPHINX_EXPORT
00247 fsg_set_t *ps_update_fsgset(ps_decoder_t *ps);
00248 
00268 POCKETSPHINX_EXPORT
00269 int ps_add_word(ps_decoder_t *ps,
00270                 char const *word,
00271                 char const *phones,
00272                 int update);
00273 
00289 POCKETSPHINX_EXPORT
00290 int ps_decode_raw(ps_decoder_t *ps, FILE *rawfh,
00291                   char const *uttid, long maxsamps);
00292 
00305 POCKETSPHINX_EXPORT
00306 int ps_start_utt(ps_decoder_t *ps, char const *uttid);
00307 
00315 POCKETSPHINX_EXPORT
00316 char const *ps_get_uttid(ps_decoder_t *ps);
00330 POCKETSPHINX_EXPORT
00331 int ps_process_raw(ps_decoder_t *ps,
00332                    int16 const *data,
00333                    size_t n_samples,
00334                    int no_search,
00335                    int full_utt);
00336 
00350 POCKETSPHINX_EXPORT
00351 int ps_process_cep(ps_decoder_t *ps,
00352                    mfcc_t **data,
00353                    int n_frames,
00354                    int no_search,
00355                    int full_utt);
00356 
00370 POCKETSPHINX_EXPORT
00371 int ps_get_n_frames(ps_decoder_t *ps);
00372 
00379 POCKETSPHINX_EXPORT
00380 int ps_end_utt(ps_decoder_t *ps);
00381 
00391 POCKETSPHINX_EXPORT
00392 char const *ps_get_hyp(ps_decoder_t *ps, int32 *out_best_score,
00393                        char const **out_uttid);
00394 
00409 POCKETSPHINX_EXPORT
00410 int32 ps_get_prob(ps_decoder_t *ps, char const **out_uttid);
00411 
00425 POCKETSPHINX_EXPORT
00426 ps_lattice_t *ps_get_lattice(ps_decoder_t *ps);
00427 
00436 POCKETSPHINX_EXPORT
00437 ps_seg_t *ps_seg_iter(ps_decoder_t *ps, int32 *out_best_score);
00438 
00446 POCKETSPHINX_EXPORT
00447 ps_seg_t *ps_seg_next(ps_seg_t *seg);
00448 
00456 POCKETSPHINX_EXPORT
00457 char const *ps_seg_word(ps_seg_t *seg);
00458 
00470 POCKETSPHINX_EXPORT
00471 void ps_seg_frames(ps_seg_t *seg, int *out_sf, int *out_ef);
00472 
00495 POCKETSPHINX_EXPORT
00496 int32 ps_seg_prob(ps_seg_t *seg, int32 *out_ascr, int32 *out_lscr, int32 *out_lback);
00497 
00501 POCKETSPHINX_EXPORT
00502 void ps_seg_free(ps_seg_t *seg);
00503 
00515 POCKETSPHINX_EXPORT
00516 ps_nbest_t *ps_nbest(ps_decoder_t *ps, int sf, int ef,
00517                      char const *ctx1, char const *ctx2);
00518 
00526 POCKETSPHINX_EXPORT 
00527 ps_nbest_t *ps_nbest_next(ps_nbest_t *nbest);
00528 
00536 POCKETSPHINX_EXPORT
00537 char const *ps_nbest_hyp(ps_nbest_t *nbest, int32 *out_score);
00538 
00546 POCKETSPHINX_EXPORT
00547 ps_seg_t *ps_nbest_seg(ps_nbest_t *nbest, int32 *out_score);
00548 
00554 POCKETSPHINX_EXPORT
00555 void ps_nbest_free(ps_nbest_t *nbest);
00556 
00565 POCKETSPHINX_EXPORT
00566 void ps_get_utt_time(ps_decoder_t *ps, double *out_nspeech,
00567                      double *out_ncpu, double *out_nwall);
00568 
00577 POCKETSPHINX_EXPORT
00578 void ps_get_all_time(ps_decoder_t *ps, double *out_nspeech,
00579                      double *out_ncpu, double *out_nwall);
00580 
00594 #ifdef __cplusplus
00595 } /* extern "C" */
00596 #endif
00597 
00598 #endif /* __POCKETSPHINX_H__ */

Generated on Thu Jan 27 2011 for PocketSphinx by  doxygen 1.7.1