Implementation of dict2pid. More...
#include <string.h>#include "dict2pid.h"#include "hmm.h"Go to the source code of this file.
Functions | |
| void | compress_table (s3ssid_t *uncomp_tab, s3ssid_t *com_tab, s3cipid_t *ci_map, int32 n_ci) |
| int32 | get_rc_nssid (dict2pid_t *d2p, s3wid_t w, s3dict_t *dict) |
| ARCHAN, A duplicate of get_rc_npid in ctxt_table.h. | |
| s3cipid_t * | dict2pid_get_rcmap (dict2pid_t *d2p, s3wid_t w, s3dict_t *dict) |
| Get RC map. | |
| dict2pid_t * | dict2pid_build (bin_mdef_t *mdef, s3dict_t *dict, int32 is_composite, logmath_t *logmath) |
| Build the dict2pid structure for the given model/dictionary. | |
| dict2pid_t * | dict2pid_retain (dict2pid_t *d2p) |
| Retain a pointer to dict2pid. | |
| int | dict2pid_free (dict2pid_t *d2p) |
| Free the memory dict2pid structure. | |
| void | dict2pid_report (dict2pid_t *d2p) |
| Report a dict2pid data structure. | |
| void | dict2pid_comsenscr (dict2pid_t *d2p, int16 const *senscr, int16 *comsenscr) |
| Populate composite senone score array. | |
| void | dict2pid_comsseq2sen_active (dict2pid_t *d2p, bin_mdef_t *mdef, bitvec_t *comssid, bitvec_t *sen) |
| Mark senones active based on a set of active composite senones. | |
| void | dict2pid_dump (FILE *fp, dict2pid_t *d2p, bin_mdef_t *mdef, s3dict_t *dict) |
| For debugging. | |
Implementation of dict2pid.
A general remark, notice "comsseq" sometimes means compressed sequence. It should be understood as differnet thing as composite in the source code.
Definition in file dict2pid.c.
| void compress_table | ( | s3ssid_t * | uncomp_tab, | |
| s3ssid_t * | com_tab, | |||
| s3cipid_t * | ci_map, | |||
| int32 | n_ci | |||
| ) |
Compress this map
Definition at line 376 of file dict2pid.c.
References BAD_S3CIPID, and BAD_S3SSID.
| dict2pid_t* dict2pid_build | ( | bin_mdef_t * | mdef, | |
| s3dict_t * | dict, | |||
| int32 | is_composite, | |||
| logmath_t * | logmath | |||
| ) |
Build the dict2pid structure for the given model/dictionary.
This segments of code take care of the initialization of internal[0] and ldiph[b][r][l]
This part will take care of the initialization of internal[pronlen-1] and rdiph[b][l][r]. Notice that this is symmetric to the first part of the code.
| mdef | A model definition | |
| dict | An initialized dictionary | |
| is_composite | Whether composite triphones will be built |
Definition at line 594 of file dict2pid.c.
References BAD_S3SENID, BAD_S3SSID, dict2pid_t::comsseq, dict2pid_t::comstate, dict2pid_t::comwt, dict2pid_report(), dict2pid_t::internal, dict2pid_t::is_composite, dict2pid_t::ldiph_lc, dict2pid_t::lrdiph_rc, dict2pid_t::lrssid, dict2pid_t::n_ci, bin_mdef_s::n_ciphone, dict2pid_t::n_comsseq, dict2pid_t::n_comstate, dict2pid_t::n_dictsize, bin_mdef_s::n_emit_state, dict2pid_t::rdiph_rc, dict2pid_t::rssid, SENSCR_SHIFT, dict2pid_t::single_lc, WORD_POSN_BEGIN, WORD_POSN_END, WORD_POSN_INTERNAL, and WORD_POSN_SINGLE.
Referenced by ps_reinit().
| void dict2pid_comsenscr | ( | dict2pid_t * | d2p, | |
| int16 const * | senscr, | |||
| int16 * | comsenscr | |||
| ) |
Populate composite senone score array.
Compute composite senone scores from ordinary senone scores (max of component senones).
The composite senone score is the maximum of its component senones' scores, scaled down by the number of component senones.
| d2p | In: a dict2pid_t structure | |
| senscr | In: Ordinary senone scores | |
| comsenscr | Out: Composite senone scores |
Definition at line 1064 of file dict2pid.c.
References dict2pid_t::comstate, dict2pid_t::comwt, and dict2pid_t::n_comstate.
| void dict2pid_comsseq2sen_active | ( | dict2pid_t * | d2p, | |
| bin_mdef_t * | mdef, | |||
| bitvec_t * | comssid, | |||
| bitvec_t * | sen | |||
| ) |
Mark senones active based on a set of active composite senones.
Mark active senones as indicated by the input array of composite senone-sequence active flags.
| d2p | In: a dict2pid_t structure | |
| mdef | In: a bin_mdef_t structure | |
| comssid | In: Active flag for each comssid | |
| sen | In/Out: Active flags set for senones indicated by the active comssid |
Definition at line 1090 of file dict2pid.c.
References dict2pid_t::comsseq, dict2pid_t::comstate, and dict2pid_t::n_comsseq.
| void dict2pid_dump | ( | FILE * | fp, | |
| dict2pid_t * | d2p, | |||
| bin_mdef_t * | mdef, | |||
| s3dict_t * | dict | |||
| ) |
For debugging.
| fp | In: a file pointer | |
| d2p | In: a dict2pid_t structure | |
| mdef | In: a bin_mdef_t structure | |
| dict | In: a dictionary structure |
Definition at line 1115 of file dict2pid.c.
References dict2pid_t::comsseq, dict2pid_t::comstate, dict2pid_t::internal, dict2pid_t::ldiph_lc, dict2pid_t::n_comsseq, dict2pid_t::n_comstate, bin_mdef_s::n_sseq, dict2pid_t::single_lc, and bin_mdef_s::sseq.
| int dict2pid_free | ( | dict2pid_t * | d2p | ) |
Free the memory dict2pid structure.
| d2p | In: the d2p |
Definition at line 984 of file dict2pid.c.
References dict2pid_t::comsseq, dict2pid_t::comstate, dict2pid_t::comwt, dict2pid_t::internal, dict2pid_t::ldiph_lc, dict2pid_t::lrdiph_rc, dict2pid_t::lrssid, dict2pid_t::n_ci, dict2pid_t::n_comsseq, dict2pid_t::rdiph_rc, dict2pid_t::rssid, and dict2pid_t::single_lc.
Referenced by ps_free().
| s3cipid_t* dict2pid_get_rcmap | ( | dict2pid_t * | d2p, | |
| s3wid_t | w, | |||
| s3dict_t * | dict | |||
| ) |
Get RC map.
| d2p | In: a dict2pid | |
| w | In: a wid | |
| dict | In: a dictionary |
Definition at line 551 of file dict2pid.c.
References xwdssid_t::cimap, dictword_t::ciphone, dict2pid_t::lrssid, dictword_t::pronlen, dict2pid_t::rssid, and s3dict_t::word.
| void dict2pid_report | ( | dict2pid_t * | d2p | ) |
Report a dict2pid data structure.
| d2p | In: a dict2pid_t structure |
Definition at line 1041 of file dict2pid.c.
References dict2pid_t::is_composite, dict2pid_t::n_comsseq, and dict2pid_t::n_comstate.
Referenced by dict2pid_build().
| int32 get_rc_nssid | ( | dict2pid_t * | d2p, | |
| s3wid_t | w, | |||
| s3dict_t * | dict | |||
| ) |
ARCHAN, A duplicate of get_rc_npid in ctxt_table.h.
Get number of rc.
I doubt whether it is correct because the compressed map has not been checked.
| d2p | In: a dict2pid | |
| w | In: a wid | |
| dict | In: a dictionary |
Definition at line 527 of file dict2pid.c.
References dictword_t::ciphone, dict2pid_t::lrssid, xwdssid_t::n_ssid, dictword_t::pronlen, dict2pid_t::rssid, and s3dict_t::word.
Referenced by lextree_enter(), lextree_hmm_propagate_non_leaves(), and vithist_enter().
1.6.1