Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef __JSGF_H__
00039 #define __JSGF_H__
00040
00048 #include <stdio.h>
00049
00050
00051 #include <sphinxbase_export.h>
00052 #include <hash_table.h>
00053 #include <fsg_model.h>
00054 #include <logmath.h>
00055
00056 #ifdef __cplusplus
00057 extern "C" {
00058 #endif
00059 #if 0
00060
00061 }
00062 #endif
00063
00064 typedef struct jsgf_s jsgf_t;
00065 typedef struct jsgf_rule_s jsgf_rule_t;
00066
00073 SPHINXBASE_EXPORT
00074 jsgf_t *jsgf_grammar_new(jsgf_t *parent);
00075
00083 SPHINXBASE_EXPORT
00084 jsgf_t *jsgf_parse_file(const char *filename, jsgf_t *parent);
00085
00089 SPHINXBASE_EXPORT
00090 void jsgf_grammar_free(jsgf_t *jsgf);
00091
00095 typedef hash_iter_t jsgf_rule_iter_t;
00096
00100 SPHINXBASE_EXPORT
00101 jsgf_rule_iter_t *jsgf_rule_iter(jsgf_t *grammar);
00102
00106 #define jsgf_rule_iter_next(itor) hash_table_iter_next(itor)
00107
00111 #define jsgf_rule_iter_rule(itor) ((jsgf_rule_t *)(itor)->ent->val)
00112
00116 #define jsgf_rule_iter_free(itor) hash_table_iter_free(itor)
00117
00121 SPHINXBASE_EXPORT
00122 jsgf_rule_t *jsgf_get_rule(jsgf_t *grammar, char const *name);
00123
00127 SPHINXBASE_EXPORT
00128 char const *jsgf_rule_name(jsgf_rule_t *rule);
00129
00133 SPHINXBASE_EXPORT
00134 int jsgf_rule_public(jsgf_rule_t *rule);
00135
00139 SPHINXBASE_EXPORT
00140 fsg_model_t *jsgf_build_fsg(jsgf_t *grammar, jsgf_rule_t *rule,
00141 logmath_t *lmath, float32 lw);
00142
00151 SPHINXBASE_EXPORT
00152 fsg_model_t *jsgf_build_fsg_raw(jsgf_t *grammar, jsgf_rule_t *rule,
00153 logmath_t *lmath, float32 lw);
00154
00161 SPHINXBASE_EXPORT
00162 int jsgf_write_fsg(jsgf_t *grammar, jsgf_rule_t *rule, FILE *outfh);
00163
00164 #ifdef __cplusplus
00165 }
00166 #endif
00167
00168
00169 #endif