#include <julius/julius.h>
Go to the source code of this file.
Defines | |
#define | MDEBUG |
For debug: define to enable grammar update messages to stdout. | |
Functions | |
static boolean | multigram_rebuild_wchmm (RecogProcess *r) |
Build tree lexicon from global grammar. | |
boolean | multigram_build (RecogProcess *r) |
Check for global grammar and (re-)build tree lexicon if needed. | |
static boolean | multigram_append_to_global (DFA_INFO *gdfa, WORD_INFO *gwinfo, MULTIGRAM *m) |
Append a grammar to the tail of global grammar. | |
int | multigram_add (DFA_INFO *dfa, WORD_INFO *winfo, char *name, PROCESS_LM *lm) |
Add a new grammar to the current list of grammars. | |
boolean | multigram_delete (int delid, PROCESS_LM *lm) |
Mark a grammar in the grammar list to be deleted at the next grammar update. | |
void | multigram_delete_all (PROCESS_LM *lm) |
Mark all grammars to be deleted at next grammar update. | |
static boolean | multigram_exec_delete (PROCESS_LM *lm) |
Purge grammars marked as delete. | |
int | multigram_activate (int gid, PROCESS_LM *lm) |
Activate a grammar in the grammar list. | |
int | multigram_deactivate (int gid, PROCESS_LM *lm) |
Deactivate a grammar in the grammar list. | |
static boolean | multigram_exec_activate (PROCESS_LM *lm) |
Execute (de)activation of grammars. | |
boolean | multigram_update (PROCESS_LM *lm) |
Update global grammar if needed. | |
static boolean | multigram_read_file_and_add (char *dfa_file, char *dict_file, PROCESS_LM *lm) |
Add grammar to the grammar list specified by dfa file and dict file. | |
boolean | multigram_load_all_gramlist (PROCESS_LM *lm) |
Load all the grammars specified at startup. | |
int | multigram_get_all_num (PROCESS_LM *lm) |
Get the number of current grammars (both active and inactive). | |
int | multigram_get_gram_from_category (int category, PROCESS_LM *lm) |
Get which grammar the given category belongs to. | |
int | multigram_get_gram_from_wid (WORD_ID wid, PROCESS_LM *lm) |
Get which grammar the given word belongs to. | |
void | multigram_free_all (MULTIGRAM *root) |
Free all grammars. | |
int | multigram_get_id_by_name (PROCESS_LM *lm, char *gramname) |
Return a grammar ID of the given grammar name. | |
MULTIGRAM * | multigram_get_grammar_by_name (PROCESS_LM *lm, char *gramname) |
Find a grammar in LM by its name. | |
MULTIGRAM * | multigram_get_grammar_by_id (PROCESS_LM *lm, unsigned short id) |
Find a grammar in LM by its ID number. | |
boolean | multigram_add_words_to_grammar (PROCESS_LM *lm, MULTIGRAM *m, WORD_INFO *winfo) |
Append words to a grammar. | |
boolean | multigram_add_words_to_grammar_by_name (PROCESS_LM *lm, char *gramname, WORD_INFO *winfo) |
Append words to a grammar, given by its name. | |
boolean | multigram_add_words_to_grammar_by_id (PROCESS_LM *lm, unsigned short id, WORD_INFO *winfo) |
Append words to a grammar, given by its ID number. |
This file contains functions to read and manage recognition grammar. These function read in grammar and dictionary, and setup data for recognition.
Recognition with multiple grammars are supported. Julian can read several grammars specified at startup time, and perform recognition with those grammars simultaneously. In module mode, you can add / delete / activate / deactivate each grammar while performing recognition, and also can output optimum results for each grammar.
Internally, the given grammars are composed to a single Global Grammar. The global grammar will be updated whenever a new grammar has been read or deleted. The syntax rule (DFA) of the global grammar will be stored at global_dfa, and the corresponding dictionary will be at global_winfo locally, independent of the decoding timing. After that, multigram_build() will be called to make the prepared global grammar to be used in the actual recognition process, by copying the grammar and the dictionary to the global variable dfa and winfo.
Definition in file multi-gram.c.
static boolean multigram_rebuild_wchmm | ( | RecogProcess * | r | ) | [static] |
Build tree lexicon from global grammar.
This function will re-construct the tree lexicon using the global grammar in the recognition process instance. If the beam width was not explicitly specified on startup, the the beam width will be guessed according to the size of the new lexicon.
r | [i/o] recognition process instance |
Definition at line 89 of file multi-gram.c.
Referenced by multigram_build().
static boolean multigram_append_to_global | ( | DFA_INFO * | gdfa, | |
WORD_INFO * | gwinfo, | |||
MULTIGRAM * | m | |||
) | [static] |
Append a grammar to the tail of global grammar.
The location of the grammar in the global grammar (categories and words) will be stored to the grammar structure for later access.
gdfa | [i/o] DFA information of the global grammar | |
gwinfo | [i/o] Dictionary information of the global grammar | |
m | [i/o] New grammar information to be installed. |
Definition at line 211 of file multi-gram.c.
Referenced by multigram_update().
static boolean multigram_exec_delete | ( | PROCESS_LM * | lm | ) | [static] |
Purge grammars marked as delete.
lm | [i/o] LM processing instance |
Definition at line 390 of file multi-gram.c.
Referenced by multigram_update().
static boolean multigram_exec_activate | ( | PROCESS_LM * | lm | ) | [static] |
Execute (de)activation of grammars.
lm | [i/o] LM processing instance |
Definition at line 559 of file multi-gram.c.
Referenced by multigram_update().
static boolean multigram_read_file_and_add | ( | char * | dfa_file, | |
char * | dict_file, | |||
PROCESS_LM * | lm | |||
) | [static] |
Add grammar to the grammar list specified by dfa file and dict file.
dfa_file | [in] dfa file name | |
dict_file | [in] dict file name | |
lm | [i/o] LM processing instance |
Definition at line 791 of file multi-gram.c.
Referenced by multigram_load_all_gramlist().
boolean multigram_load_all_gramlist | ( | PROCESS_LM * | lm | ) |
Load all the grammars specified at startup.
lm | [i/o] LM processing instance |
Definition at line 886 of file multi-gram.c.
Referenced by j_load_lm().
Here is the caller graph for this function:
void multigram_free_all | ( | MULTIGRAM * | root | ) |
Free all grammars.
root | [in] root pointer of grammar list |
Definition at line 1027 of file multi-gram.c.
Referenced by j_process_lm_free().
Here is the caller graph for this function: