dict2pid.h File Reference
Building triphones for a dictionary. More...
#include <stdio.h>
#include <logmath.h>
#include "s3types.h"
#include "mdef.h"
#include "dict.h"
#include "ctxt_table.h"
Go to the source code of this file.
|
Classes |
| struct | dict2pid_t |
| | Building composite triphone (as well as word internal triphones) with the dictionary. More...
|
Defines |
| #define | dict2pid_internal(d, w, p) ((d)->internal[w][p]) |
| #define | dict2pid_n_comstate(d) ((d)->n_comstate) |
| #define | dict2pid_n_comsseq(d) ((d)->n_comsseq) |
| #define | dict2pid_is_composite(d) ((d)->is_composite) |
| #define | IS_COMPOSITE 1 |
| #define | NOT_COMPOSITE 0 |
Functions |
| dict2pid_t * | dict2pid_build (mdef_t *mdef, dict_t *dict, int32 is_composite, logmath_t *logmath) |
| void | dict2pid_free (dict2pid_t *d2p) |
| void | dict2pid_comsenscr (dict2pid_t *d2p, int32 *senscr, int32 *comsenscr) |
| void | dict2pid_comsseq2sen_active (dict2pid_t *d2p, mdef_t *mdef, uint8 *comssid, uint8 *sen) |
| void | dict2pid_dump (FILE *fp, dict2pid_t *d2p, mdef_t *mdef, dict_t *dict) |
| void | dict2pid_report (dict2pid_t *d2p) |
| int32 | get_rc_nssid (dict2pid_t *d2p, s3wid_t w, dict_t *dict) |
| s3cipid_t * | dict2pid_get_rcmap (dict2pid_t *d2p, s3wid_t w, dict_t *dict) |
Detailed Description
Building triphones for a dictionary.
This is one of the more complicated parts of a cross-word triphone model decoder. The first and last phones of each word get their left and right contexts, respectively, from other words. For single-phone words, both its contexts are from other words, simultaneously. As these words are not known beforehand, life gets complicated. In this implementation, when we do not wish to distinguish between distinct contexts, we use a COMPOSITE triphone (a bit like BBN's fast-match implementation), by clubbing together all possible contexts.
There are 3 cases:
1. Internal phones, and boundary phones without any specific context, in each word. The boundary phones are modelled using composite phones, internal ones using ordinary phones.
2. The first phone of a multi-phone word, for a specific history (i.e., in a 2g/3g/4g... tree) has known left and right contexts. The possible left contexts are limited to the possible last phones of the history. So it can be modelled separately, efficiently, as an ordinary triphone.
3. The one phone in a single-phone word, for a specific history (i.e., in a 2g/3g/4g... tree) has a known left context, but unknown right context. It is modelled using a composite triphone. (Note that right contexts are always composite, left contexts are composite only in the unigram tree.)
A composite triphone is formed as follows. (NOTE: this assumes that all CIphones/triphones have the same HMM topology, specifically, no. of states.) A composite triphone represents a situation where either the left or the right context (or both) for a given base phone is unknown. That is, it represents the set of all possible ordinary triphones derivable from * the unkown context(s). Let us call this set S. It is modelled using the same HMM topology * as the ordinary triphones, but with COMPOSITE states. A composite state (in a given position * in the HMM state topology) is the set of states (senones) at that position derived from S.
Actually, we generally deal with COMPOSITE SENONE-SEQUENCES rather than COMPOSITE PHONES. The former are compressed forms of the latter, by virtue of state sharing among phones. (See mdef.h.)
In 3.6, the composite triphone will only be build when -composite 1 (default) is specified. Other than that, full triphone expansion will be carried out in run-time
Define Documentation
| #define dict2pid_internal |
( |
d, |
|
|
w, |
|
|
p |
|
) |
((d)->internal[w][p]) |
|
| #define dict2pid_is_composite |
( |
d |
|
) |
((d)->is_composite) |
|
|
|
return whether dict2pid is in composite triphone mode or not |
| #define dict2pid_n_comsseq |
( |
d |
|
) |
((d)->n_comsseq) |
|
|
|
return number of composite state sequence |
| #define dict2pid_n_comstate |
( |
d |
|
) |
((d)->n_comstate) |
|
|
|
return number of composite state |
Function Documentation
|
|
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. - Parameters:
-
| mdef |
A model definition |
| dict |
An initialized dictionary |
| is_composite |
Whether composite triphones will be built |
|
| void dict2pid_comsenscr |
( |
dict2pid_t * |
d2p, |
|
|
int32 * |
senscr, |
|
|
int32 * |
comsenscr |
|
) |
|
|
|
|
Populate composite senone score array.
The composite senone score is the maximum of its component senones' scores, scaled down by the number of component senones. - Parameters:
-
| d2p |
In: a dict2pid_t structure |
| senscr |
In: Ordinary senone scores |
| comsenscr |
Out: Composite senone scores |
|
| void dict2pid_comsseq2sen_active |
( |
dict2pid_t * |
d2p, |
|
|
mdef_t * |
mdef, |
|
|
uint8 * |
comssid, |
|
|
uint8 * |
sen |
|
) |
|
|
|
|
Mark senones active based on a set of active composite senones. - Parameters:
-
| d2p |
In: a dict2pid_t structure |
| mdef |
In: a mdef_t structure |
| comssid |
In: Active flag for each comssid |
| sen |
In/Out: Active flags set for senones indicated by the active comssid |
|
|
|
For debugging - Parameters:
-
| fp |
In: a file pointer |
| d2p |
In: a dict2pid_t structure |
| mdef |
In: a mdef_t structure |
| dict |
In: a dictionary structure |
|
|
|
Free the memory dict2pid structure - Parameters:
-
|
|
|
Get RC map - Parameters:
-
| d2p |
In: a dict2pid |
| w |
In: a wid |
| dict |
In: a dictionary |
|
|
|
Report a dict2pid data structure - Parameters:
-
|
|
|
ARCHAN, A duplicate of get_rc_npid in ctxt_table.h. I doubt whether it is correct because the compressed map has not been checked. - Parameters:
-
| d2p |
In: a dict2pid |
| w |
In: a wid |
| dict |
In: a dictionary |
|
Generated on Sat Apr 11 00:02:29 2009 by
1.3.9.1