39 #ifndef __S2_FSG_LEXTREE_H__
40 #define __S2_FSG_LEXTREE_H__
43 #include <sphinxbase/cmd_ln.h>
44 #include <sphinxbase/fsg_model.h>
58 #define FSG_PNODE_CTXT_BVSZ 4
61 uint32 bv[FSG_PNODE_CTXT_BVSZ];
138 #define fsg_pnode_leaf(p) ((p)->leaf)
139 #define fsg_pnode_logs2prob(p) ((p)->logs2prob)
140 #define fsg_pnode_succ(p) ((p)->next.succ)
141 #define fsg_pnode_fsglink(p) ((p)->next.fsglink)
142 #define fsg_pnode_sibling(p) ((p)->sibling)
143 #define fsg_pnode_hmmptr(p) (&((p)->hmm))
144 #define fsg_pnode_ci_ext(p) ((p)->ci_ext)
145 #define fsg_pnode_ppos(p) ((p)->ppos)
146 #define fsg_pnode_leaf(p) ((p)->leaf)
147 #define fsg_pnode_ctxt(p) ((p)->ctxt)
149 #define fsg_pnode_add_ctxt(p,c) ((p)->ctxt.bv[(c)>>5] |= (1 << ((c)&0x001f)))
160 #if (FSG_PNODE_CTXT_BVSZ == 1)
161 #define FSG_PNODE_CTXT_SUB(src,sub) \
162 ((src)->bv[0] = (~((sub)->bv[0]) & (src)->bv[0]))
163 #elif (FSG_PNODE_CTXT_BVSZ == 2)
164 #define FSG_PNODE_CTXT_SUB(src,sub) \
165 (((src)->bv[0] = (~((sub)->bv[0]) & (src)->bv[0])) | \
166 ((src)->bv[1] = (~((sub)->bv[1]) & (src)->bv[1])))
167 #elif (FSG_PNODE_CTXT_BVSZ == 4)
168 #define FSG_PNODE_CTXT_SUB(src,sub) \
169 (((src)->bv[0] = (~((sub)->bv[0]) & (src)->bv[0])) | \
170 ((src)->bv[1] = (~((sub)->bv[1]) & (src)->bv[1])) | \
171 ((src)->bv[2] = (~((sub)->bv[2]) & (src)->bv[2])) | \
172 ((src)->bv[3] = (~((sub)->bv[3]) & (src)->bv[3])))
174 #define FSG_PNODE_CTXT_SUB(src,sub) fsg_pnode_ctxt_sub_generic((src),(sub))
219 #define fsg_lextree_root(lt,s) ((lt)->root[s])
220 #define fsg_lextree_n_pnode(lt) ((lt)->n_pnode)
228 int32 wip, int32 pip);
void fsg_lextree_free(fsg_lextree_t *lextree)
Free lextrees for an FSG.
hmm_context_t * ctx
HMM context structure.
Building triphones for a dictionary.
void fsg_pnode_add_all_ctxt(fsg_pnode_ctxt_t *ctxt)
Set all flags on in the given context bitvector.
An individual HMM among the HMM search space.
bin_mdef_t * mdef
Model definition (triphone mappings).
uint32 fsg_pnode_ctxt_sub_generic(fsg_pnode_ctxt_t *src, fsg_pnode_ctxt_t *sub)
Generic variant for arbitrary size.
void fsg_lextree_dump(fsg_lextree_t *lextree, FILE *fp)
Print an FSG lextree to a file for debugging.
Operations on dictionary.
Implementation of HMM base structure.
void fsg_psubtree_pnode_deactivate(fsg_pnode_t *pnode)
Mark the given pnode as inactive (for search).
dict_t * dict
Pronunciation dictionary for this FSG.
Shared information between a set of HMMs.
Collection of lextrees for an FSG.
a structure for a dictionary.
int16 ** rc
Right context triphone mappings for FSG.
int16 ** lc
Left context triphone mappings for FSG.
fsg_lextree_t * fsg_lextree_init(fsg_model_t *fsg, dict_t *dict, dict2pid_t *d2p, bin_mdef_t *mdef, hmm_context_t *ctx, int32 wip, int32 pip)
Create, initialize, and return a new phonetic lextree for the given FSG.
fsg_model_t * fsg
The fsg for which this lextree is built.
Building composite triphone (as well as word internal triphones) with the dictionary.
dict2pid_t * d2p
Context-dependent phone mappings for this FSG.