#include <julius.h>
Include dependency graph for multi-gram.c:
Go to the source code of this file.
Defines | |
#define | MDEBUG |
For debug: define this if you want grammar update messages to stdout. | |
Functions | |
static void | multigram_setup (DFA_INFO *d, WORD_INFO *w) |
Setup informations for recognition with the given grammar. | |
static void | print_all_gram () |
static void | send_gram_info () |
static void | multigram_build_append (DFA_INFO *gdfa, WORD_INFO *gwinfo, MULTIGRAM *m) |
void | multigram_add (DFA_INFO *dfa, WORD_INFO *winfo, char *name) |
boolean | multigram_delete (int delid) |
void | multigram_delete_all () |
static boolean | multigram_exec_delete () |
void | multigram_activate (int gid) |
void | multigram_deactivate (int gid) |
static boolean | multigram_exec_activate () |
boolean | multigram_exec () |
Update and re-construct global grammar if needed. | |
void | multigram_read_file (char *dfa_file, char *dict_file) |
void | multigram_add_gramlist (char *dfafile, char *dictfile) |
void | multigram_remove_gramlist () |
void | multigram_read_all_gramlist () |
void | multigram_add_prefix_list (char *prefix_list, char *cwd) |
Add multiple grammars given by their prefixs to the grammar list. | |
void | multigram_add_prefix_filelist (char *listfile) |
Add multiple grammars from prefix list file to the grammar list. | |
int | multigram_get_all_num () |
int | multigram_get_gram_from_category (int category) |
Variables | |
static DFA_INFO * | global_dfa = NULL |
static WORD_INFO * | global_winfo = NULL |
static int | gram_maxid = 0 |
static char * | hookstr [] = {"", "delete", "activate", "deactivate"} |
Grammar status to be processed in the next reload timing. |
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_setup() 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.
|
Setup informations for recognition with the given grammar. This function will re-construct the tree lexicon using the given grammar and dictionary to prepare for the recognition. If explicit value is not specified for the beam width on startup, it also resets the beam width according to the size of the new dictionary. The given grammars (DFA and dictionary) and the rebuilt tree lexicon will be set to the global variables "dfa", "winfo" and "wchmm" to be accessible from recognition functions.
Definition at line 115 of file multi-gram.c. Referenced by multigram_exec(). |
|
Output current list of grammars to stdout. Definition at line 176 of file multi-gram.c. Referenced by multigram_add(), and multigram_exec(). |
|
Send current list of grammars to module client. Definition at line 209 of file multi-gram.c. Referenced by multigram_add(), and multigram_exec(). |
|
Install a new grammar to the existing one.
Definition at line 249 of file multi-gram.c. Referenced by multigram_exec(). |
|
Add a new grammar to the current list of grammars.
Definition at line 291 of file multi-gram.c. Referenced by multigram_read_file(). |
|
Mark a grammar in the grammar list to be deleted at the next grammar update.
Definition at line 342 of file multi-gram.c. |
|
Mark all grammars in the grammar list to be deleted at the next grammar update. Definition at line 372 of file multi-gram.c. |
|
Purge grammars that has been marked as delete.
Definition at line 393 of file multi-gram.c. Referenced by multigram_exec(). |
|
Activate specified grammar in the grammar list. The specified grammar will only be marked as to be activated in the next grammar update timing.
Definition at line 444 of file multi-gram.c. |
|
Deactivate a grammar in the grammar list. The words of the de-activated grammar will not be expanded in the recognition process. This feature enables rapid switching of grammars without re-building tree lexicon. The de-activated grammar will again be activated by calling multigram_activate().
Definition at line 490 of file multi-gram.c. |
|
Execute (de)activation of grammars previously marked as so.
Definition at line 523 of file multi-gram.c. Referenced by multigram_exec(). |
|
Update and re-construct global grammar if needed. This function checks for any modification in the grammar list from previous call, and update the global grammar if needed. If there are grammars marked to be deleted in the grammar list, they will be actually deleted from memory. Then the global grammar is built from scratch using the rest grammars. If there are new grammars, they are appended to the current global grammar. If any modification of the global grammar occured in the process above, the tree lexicons and some other data for recognition will be re-constructed from the updated global grammar.
Definition at line 587 of file multi-gram.c. Referenced by final_fusion(), and main_recognition_loop(). |
|
Read in dfa file and dict file, and add them to the grammar list.
Definition at line 689 of file multi-gram.c. Referenced by multigram_read_all_gramlist(). |
|
Add a grammar to the grammar list to be read at startup.
Definition at line 756 of file multi-gram.c. Referenced by final_fusion(), multigram_add_prefix_filelist(), and multigram_add_prefix_list(). |
|
Remove the grammar list to be read at startup. Definition at line 778 of file multi-gram.c. Referenced by opt_parse(). |
|
Read in all the grammars specified at startup. Definition at line 805 of file multi-gram.c. Referenced by final_fusion(). |
|
Add multiple grammars given by their prefixs to the grammar list. This function read in several grammars, given a prefix string that contains a list of file prefixes separated by comma: "foo" or "foo,bar". For each prefix, string ".dfa" and ".dict" will be appended to read dfa file and dict file. The read grammars will be added to the grammar list.
Definition at line 840 of file multi-gram.c. Referenced by opt_parse(). |
|
Add multiple grammars from prefix list file to the grammar list. This function read in multiple grammars at once, given a file that contains a list of grammar prefixes, each per line. For each prefix, string ".dfa" and ".dict" will be appended to read the corresponding dfa and dict file. The read grammars will be added to the grammar list.
Definition at line 902 of file multi-gram.c. Referenced by opt_parse(). |
|
Get the number of current grammars (both active and inactive).
Definition at line 972 of file multi-gram.c. Referenced by ttyout_pass2(). |
|
Get which grammar the given category belongs to.
Definition at line 999 of file multi-gram.c. Referenced by msock_pass2(), and ttyout_pass2(). |
|
Pointer to hold DFA information of the current global grammar. This is used to build a global grammar. Definition at line 72 of file multi-gram.c. |
|
Pointer to hold vocabulary information of the current global grammar. This is used to build a global grammar. Definition at line 78 of file multi-gram.c. |
|
Current maximum value of assigned grammar ID. A new grammar ID will be assigned to each new grammar. Definition at line 84 of file multi-gram.c. Referenced by multigram_add(). |