47#ifndef __FSG_MODEL_H__
48#define __FSG_MODEL_H__
61#include <sphinxbase/sphinxbase_export.h>
82#define fsg_link_from_state(l) ((l)->from_state)
83#define fsg_link_to_state(l) ((l)->to_state)
84#define fsg_link_wid(l) ((l)->wid)
85#define fsg_link_logs2prob(l) ((l)->logs2prob)
118#define fsg_model_name(f) ((f)->name)
119#define fsg_model_n_state(f) ((f)->n_state)
120#define fsg_model_start_state(f) ((f)->start_state)
121#define fsg_model_final_state(f) ((f)->final_state)
122#define fsg_model_log(f,p) logmath_log((f)->lmath, p)
123#define fsg_model_lw(f) ((f)->lw)
124#define fsg_model_n_word(f) ((f)->n_word)
125#define fsg_model_word_str(f,wid) (wid == -1 ? "(NULL)" : (f)->vocab[wid])
135#define fsg_model_has_sil(f) ((f)->silwords != NULL)
140#define fsg_model_has_alt(f) ((f)->altwords != NULL)
142#define fsg_model_is_filler(f,wid) \
143 (fsg_model_has_sil(f) ? bitvec_is_set((f)->silwords, wid) : FALSE)
144#define fsg_model_is_alt(f,wid) \
145 (fsg_model_has_alt(f) ? bitvec_is_set((f)->altwords, wid) : FALSE)
152 float32 lw, int32 n_state);
224int fsg_model_word_add(
fsg_model_t *fsg,
char const *word);
232int fsg_model_word_id(
fsg_model_t *fsg,
char const *word);
242 int32 from, int32 to, int32 logp, int32 wid);
255int32 fsg_model_null_trans_add(
fsg_model_t * fsg, int32 from, int32 to, int32 logp);
272int32 fsg_model_tag_trans_add(
fsg_model_t * fsg, int32 from, int32 to,
273 int32 logp, int32 wid);
326int fsg_model_add_silence(
fsg_model_t * fsg,
char const *silword,
327 int state, float32 silprob);
333int fsg_model_add_alt(
fsg_model_t * fsg,
char const *baseword,
334 char const *altword);
346void fsg_model_writefile(
fsg_model_t *fsg,
char const *file);
352void fsg_model_write_fsm(
fsg_model_t *fsg, FILE *fp);
358void fsg_model_writefile_fsm(
fsg_model_t *fsg,
char const *file);
364void fsg_model_write_symtab(
fsg_model_t *fsg, FILE *file);
370void fsg_model_writefile_symtab(
fsg_model_t *fsg,
char const *file);
An implementation of bit vectors.
Generic linked-lists maintenance.
Hash table implementation.
Fast memory allocator for uniformly sized objects.
Fast integer logarithmic addition operations.
Basic type definitions used in Sphinx.
Implementation of arc iterator.
int32 logs2prob
log(transition probability)*lw
int32 wid
Word-ID; <0 if epsilon or null transition.
Word level FSG definition.
int32 n_word_alloc
Number of words allocated in vocab.
int32 start_state
Must be in the range [0..n_state-1].
char ** vocab
Vocabulary for this FSG.
int32 n_state
number of states in FSG
int32 n_word
Number of unique words in this FSG.
logmath_t * lmath
Pointer to log math computation object.
char * name
A unique string identifier for this FSG.
bitvec_t * silwords
Indicates which words are silence/fillers.
listelem_alloc_t * link_alloc
Allocator for FSG links.
trans_list_t * trans
Transitions out of each state, if any.
int32 final_state
Must be in the range [0..n_state-1].
bitvec_t * altwords
Indicates which words are pronunciation alternates.
float32 lw
Language weight that's been applied to transition logprobs.
int refcount
Reference count.
A node in a generic list.
Fast linked list allocator.
Adjacency list (opaque) for a state in an FSG.