| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef __POCKETSPHINX_INTERNAL_H__ |
| | #define __POCKETSPHINX_INTERNAL_H__ |
| |
|
| | #include "fe/fe.h" |
| | #include "feat/feat.h" |
| | #include "util/cmd_ln.h" |
| | #include "util/hash_table.h" |
| | #include "util/profile.h" |
| |
|
| | #include "acmod.h" |
| | #include "dict.h" |
| | #include "dict2pid.h" |
| |
|
| | #ifdef __cplusplus |
| | extern "C" { |
| | #endif |
| | #if 0 |
| | } |
| | #endif |
| |
|
| | |
| | |
| | |
| | typedef struct ps_search_s ps_search_t; |
| |
|
| |
|
| | |
| | #define PS_DEFAULT_SEARCH "_default" |
| | #define PS_DEFAULT_PL_SEARCH "_default_pl" |
| |
|
| | |
| | #define PS_SEARCH_TYPE_KWS "kws" |
| | #define PS_SEARCH_TYPE_FSG "fsg" |
| | #define PS_SEARCH_TYPE_NGRAM "ngram" |
| | #define PS_SEARCH_TYPE_ALLPHONE "allphone" |
| | #define PS_SEARCH_TYPE_STATE_ALIGN "state_align" |
| | #define PS_SEARCH_TYPE_PHONE_LOOP "phone_loop" |
| |
|
| | |
| | |
| | |
| | typedef struct ps_searchfuncs_s { |
| | int (*start)(ps_search_t *search); |
| | int (*step)(ps_search_t *search, int frame_idx); |
| | int (*finish)(ps_search_t *search); |
| | int (*reinit)(ps_search_t *search, dict_t *dict, dict2pid_t *d2p); |
| | void (*free)(ps_search_t *search); |
| |
|
| | ps_lattice_t *(*lattice)(ps_search_t *search); |
| | char const *(*hyp)(ps_search_t *search, int32 *out_score); |
| | int32 (*prob)(ps_search_t *search); |
| | ps_seg_t *(*seg_iter)(ps_search_t *search); |
| | } ps_searchfuncs_t; |
| |
|
| | |
| | |
| | |
| | struct ps_search_s { |
| | ps_searchfuncs_t *vt; |
| | |
| | char *type; |
| | char *name; |
| | |
| | |
| | |
| | |
| | ps_search_t *pls; |
| | cmd_ln_t *config; |
| | acmod_t *acmod; |
| | dict_t *dict; |
| | dict2pid_t *d2p; |
| | char *hyp_str; |
| | ps_lattice_t *dag; |
| | ps_latlink_t *last_link; |
| | int32 post; |
| | int32 n_words; |
| | |
| |
|
| | |
| | int32 start_wid; |
| | int32 silence_wid; |
| | int32 finish_wid; |
| | }; |
| |
|
| | #define ps_search_base(s) ((ps_search_t *)s) |
| | #define ps_search_config(s) ps_search_base(s)->config |
| | #define ps_search_acmod(s) ps_search_base(s)->acmod |
| | #define ps_search_dict(s) ps_search_base(s)->dict |
| | #define ps_search_dict2pid(s) ps_search_base(s)->d2p |
| | #define ps_search_dag(s) ps_search_base(s)->dag |
| | #define ps_search_last_link(s) ps_search_base(s)->last_link |
| | #define ps_search_post(s) ps_search_base(s)->post |
| | #define ps_search_lookahead(s) ps_search_base(s)->pls |
| | #define ps_search_n_words(s) ps_search_base(s)->n_words |
| |
|
| | #define ps_search_type(s) ps_search_base(s)->type |
| | #define ps_search_name(s) ps_search_base(s)->name |
| | #define ps_search_start(s) (*(ps_search_base(s)->vt->start))(s) |
| | #define ps_search_step(s,i) (*(ps_search_base(s)->vt->step))(s,i) |
| | #define ps_search_finish(s) (*(ps_search_base(s)->vt->finish))(s) |
| | #define ps_search_reinit(s,d,d2p) (*(ps_search_base(s)->vt->reinit))(s,d,d2p) |
| | #define ps_search_free(s) (*(ps_search_base(s)->vt->free))(s) |
| | #define ps_search_lattice(s) (*(ps_search_base(s)->vt->lattice))(s) |
| | #define ps_search_hyp(s,sc) (*(ps_search_base(s)->vt->hyp))(s,sc) |
| | #define ps_search_prob(s) (*(ps_search_base(s)->vt->prob))(s) |
| | #define ps_search_seg_iter(s) (*(ps_search_base(s)->vt->seg_iter))(s) |
| |
|
| | |
| | #define ps_search_silence_wid(s) ps_search_base(s)->silence_wid |
| | #define ps_search_start_wid(s) ps_search_base(s)->start_wid |
| | #define ps_search_finish_wid(s) ps_search_base(s)->finish_wid |
| |
|
| | |
| | |
| | |
| | void ps_search_init(ps_search_t *search, ps_searchfuncs_t *vt, |
| | const char *type, const char *name, |
| | cmd_ln_t *config, acmod_t *acmod, dict_t *dict, |
| | dict2pid_t *d2p); |
| |
|
| |
|
| | |
| | |
| | |
| | void ps_search_base_free(ps_search_t *search); |
| |
|
| | |
| | |
| | |
| | void ps_search_base_reinit(ps_search_t *search, dict_t *dict, |
| | dict2pid_t *d2p); |
| |
|
| | typedef struct ps_segfuncs_s { |
| | ps_seg_t *(*seg_next)(ps_seg_t *seg); |
| | void (*seg_free)(ps_seg_t *seg); |
| | } ps_segfuncs_t; |
| |
|
| | |
| | |
| | |
| | struct ps_seg_s { |
| | ps_segfuncs_t *vt; |
| | ps_search_t *search; |
| | const char *text; |
| | frame_idx_t sf; |
| | frame_idx_t ef; |
| | s3wid_t wid; |
| | int32 ascr; |
| | int32 lscr; |
| | int32 prob; |
| | |
| | |
| | int32 lback; |
| | |
| | float32 lwf; |
| | }; |
| |
|
| | #define ps_search_seg_next(seg) (*(seg->vt->seg_next))(seg) |
| | #define ps_search_seg_free(s) (*(seg->vt->seg_free))(seg) |
| |
|
| |
|
| | |
| | |
| | |
| | struct ps_decoder_s { |
| | |
| | cmd_ln_t *config; |
| | int refcount; |
| |
|
| | |
| | acmod_t *acmod; |
| | dict_t *dict; |
| | dict2pid_t *d2p; |
| | logmath_t *lmath; |
| |
|
| | |
| | hash_table_t *searches; |
| | |
| | |
| | ps_search_t *search; |
| | ps_search_t *phone_loop; |
| | int pl_window; |
| |
|
| | |
| | uint32 uttno; |
| | ptmr_t perf; |
| | uint32 n_frame; |
| | char const *mfclogdir; |
| | char const *rawlogdir; |
| | char const *senlogdir; |
| | }; |
| |
|
| |
|
| | struct ps_search_iter_s { |
| | hash_iter_t itor; |
| | }; |
| |
|
| | #ifdef __cplusplus |
| | } |
| | #endif |
| |
|
| | #endif |
| |
|