PocketSphinx
0.6
|
Model definition. More...
#include <stdio.h>
#include <sphinxbase/hash_table.h>
Go to the source code of this file.
Data Structures | |
struct | ciphone_t |
CI phone information. More... | |
struct | phone_t |
Triphone information, including base phones as a subset. More... | |
struct | ph_rc_s |
struct | ph_lc_s |
struct | mdef_t |
The main model definition structure. More... | |
Macros | |
#define | N_WORD_POSN 4 |
total # of word positions (excluding undefined) | |
#define | WPOS_NAME "ibesu" |
Printable code for each word position above. | |
#define | S3_SILENCE_CIPHONE "SIL" |
Hard-coded silence CI phone name. | |
#define | mdef_is_fillerphone(m, p) ((m)->ciphone[p].filler) |
Access macros; not meant for arbitrary use. | |
#define | mdef_n_ciphone(m) ((m)->n_ciphone) |
#define | mdef_n_phone(m) ((m)->n_phone) |
#define | mdef_n_sseq(m) ((m)->n_sseq) |
#define | mdef_n_emit_state(m) ((m)->n_emit_state) |
#define | mdef_n_sen(m) ((m)->n_sen) |
#define | mdef_n_tmat(m) ((m)->n_tmat) |
#define | mdef_pid2ssid(m, p) ((m)->phone[p].ssid) |
#define | mdef_pid2tmatid(m, p) ((m)->phone[p].tmat) |
#define | mdef_silphone(m) ((m)->sil) |
#define | mdef_sen2cimap(m) ((m)->sen2cimap) |
#define | mdef_sseq2sen(m, ss, pos) ((m)->sseq[ss][pos]) |
#define | mdef_pid2ci(m, p) ((m)->phone[p].ci) |
#define | mdef_cd2cisen(m) ((m)->cd2cisen) |
Typedefs | |
typedef struct ph_rc_s | ph_rc_t |
typedef struct ph_lc_s | ph_lc_t |
Enumerations | |
enum | word_posn_t { WORD_POSN_INTERNAL = 0, WORD_POSN_BEGIN = 1, WORD_POSN_END = 2, WORD_POSN_SINGLE = 3, WORD_POSN_UNDEFINED = 4 } |
Union of different type of word position. More... | |
Functions | |
mdef_t * | mdef_init (char *mdeffile, int breport) |
Initialize the phone structure from the given model definition file. More... | |
int | mdef_ciphone_id (mdef_t *m, char *ciphone) |
Get the ciphone id given a string name. More... | |
const char * | mdef_ciphone_str (mdef_t *m, int ci) |
Get the phone string given the ci phone id. More... | |
int | mdef_is_ciphone (mdef_t *m, int p) |
Decide whether the phone is ci phone. More... | |
int | mdef_is_cisenone (mdef_t *m, int s) |
Decide whether the senone is a senone for a ci phone, or a ci senone. More... | |
int | mdef_phone_id (mdef_t *m, int b, int l, int r, word_posn_t pos) |
Decide the phone id given the left, right and base phones. More... | |
int | mdef_phone_str (mdef_t *m, int pid, char *buf) |
Create a phone string for the given phone (base or triphone) id in the given buf. More... | |
int | mdef_hmm_cmp (mdef_t *m, int p1, int p2) |
Compare the underlying HMMs for two given phones (i.e., compare the two transition matrix IDs and the individual state(senone) IDs). More... | |
void | mdef_report (mdef_t *m) |
Report the model definition's parameters. More... | |
void | mdef_free_recursive_lc (ph_lc_t *lc) |
RAH, For freeing memory. More... | |
void | mdef_free_recursive_rc (ph_rc_t *rc) |
void | mdef_free (mdef_t *mdef) |
Free an mdef_t. More... | |
Model definition.
Definition in file mdef.h.
enum word_posn_t |
int mdef_ciphone_id | ( | mdef_t * | m, |
char * | ciphone | ||
) |
Get the ciphone id given a string name.
m | In: Model structure being queried |
ciphone | In: ciphone for which id wanted |
Definition at line 176 of file mdef.c.
References mdef_t::ciphone_ht.
Referenced by mdef_is_cisenone().
const char* mdef_ciphone_str | ( | mdef_t * | m, |
int | ci | ||
) |
Get the phone string given the ci phone id.
m | In: Model structure being queried |
ci | In: ciphone id for which name wanted |
Definition at line 186 of file mdef.c.
References mdef_t::ciphone, and ciphone_t::name.
Referenced by mdef_phone_str().
void mdef_free | ( | mdef_t * | mdef | ) |
Free an mdef_t.
mdef | In : The model definition |
Definition at line 719 of file mdef.c.
References mdef_t::cd2cisen, mdef_t::ciphone, mdef_t::ciphone_ht, mdef_free_recursive_lc(), mdef_free_recursive_rc(), mdef_t::n_ciphone, N_WORD_POSN, ciphone_t::name, mdef_t::phone, mdef_t::sen2cimap, mdef_t::sseq, and mdef_t::wpos_ci_lclist.
void mdef_free_recursive_lc | ( | ph_lc_t * | lc | ) |
RAH, For freeing memory.
lc | In: A list of left context |
Definition at line 687 of file mdef.c.
References mdef_free_recursive_rc().
Referenced by mdef_free().
void mdef_free_recursive_rc | ( | ph_rc_t * | rc | ) |
rc | In: A list of right context |
Definition at line 702 of file mdef.c.
Referenced by mdef_free(), and mdef_free_recursive_lc().
int mdef_hmm_cmp | ( | mdef_t * | m, |
int | p1, | ||
int | p2 | ||
) |
Compare the underlying HMMs for two given phones (i.e., compare the two transition matrix IDs and the individual state(senone) IDs).
m | In: Model being queried |
p1 | In: One of the two triphones being compared |
p2 | In: One of the two triphones being compared |
mdef_t* mdef_init | ( | char * | mdeffile, |
int | breport | ||
) |
Initialize the phone structure from the given model definition file.
It should be treated as a READ-ONLY structure.
mdeffile | In: Model definition file |
breport | In: whether to report the progress or not |
Referenced by bin_mdef_read_text(), and mdef_is_cisenone().
int mdef_is_ciphone | ( | mdef_t * | m, |
int | p | ||
) |
int mdef_is_cisenone | ( | mdef_t * | m, |
int | s | ||
) |
Decide whether the senone is a senone for a ci phone, or a ci senone.
m | In: Model structure being queried |
s | In: senone id being queried |
Definition at line 260 of file mdef.c.
References mdef_t::cd2cisen, mdef_t::ciphone, mdef_t::ciphone_ht, ciphone_t::filler, mdef_ciphone_id(), mdef_init(), mdef_t::n_ci_sen, mdef_t::n_ciphone, mdef_t::n_emit_state, mdef_t::n_phone, mdef_t::n_sen, mdef_t::n_sseq, mdef_t::n_tmat, N_WORD_POSN, mdef_t::phone, S3_SILENCE_CIPHONE, mdef_t::sen2cimap, mdef_t::sil, mdef_t::sseq, phone_t::ssid, phone_t::tmat, WORD_POSN_BEGIN, WORD_POSN_END, WORD_POSN_INTERNAL, WORD_POSN_SINGLE, WORD_POSN_UNDEFINED, and mdef_t::wpos_ci_lclist.
int mdef_phone_id | ( | mdef_t * | m, |
int | b, | ||
int | l, | ||
int | r, | ||
word_posn_t | pos | ||
) |
Decide the phone id given the left, right and base phones.
m | In: Model structure being queried |
b | In: base ciphone id |
l | In: left context ciphone id |
r | In: right context ciphone id |
pos | In: Word position |
Definition at line 219 of file mdef.c.
References mdef_t::ciphone, ciphone_t::filler, N_WORD_POSN, mdef_t::sil, and mdef_t::wpos_ci_lclist.
int mdef_phone_str | ( | mdef_t * | m, |
int | pid, | ||
char * | buf | ||
) |
Create a phone string for the given phone (base or triphone) id in the given buf.
m | In: Model structure being queried |
pid | In: phone id being queried |
buf | Out: On return, buf has the string |
Definition at line 196 of file mdef.c.
References mdef_ciphone_str(), mdef_t::phone, phone_t::rc, phone_t::wpos, and WPOS_NAME.
void mdef_report | ( | mdef_t * | m | ) |
Report the model definition's parameters.
m | In: model definition structure |
Definition at line 664 of file mdef.c.
References mdef_t::n_ci_sen, mdef_t::n_ciphone, mdef_t::n_emit_state, mdef_t::n_phone, mdef_t::n_sen, and mdef_t::n_sseq.