libjulius/src/multi-gram.c File Reference

Management of Recognition grammars. More...

#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.
void 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.
void multigram_free_all (MULTIGRAM *root)
 Free all grammars.
MULTIGRAMmultigram_get_grammar_by_name (PROCESS_LM *lm, char *gramname)
 Find a grammar in LM by its name.
MULTIGRAMmultigram_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.


Detailed Description

Management of Recognition grammars.

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.

Author:
Akinobu Lee
Date:
Sat Jun 18 23:45:18 2005
Revision
1.1.1.1

Definition in file multi-gram.c.


Function Documentation

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.

Parameters:
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.

Parameters:
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.

Parameters:
lm [i/o] LM processing instance
Returns:
TRUE if the global grammar must be re-constructed, or FALSE if not needed.

Definition at line 384 of file multi-gram.c.

Referenced by multigram_update().

static boolean multigram_exec_activate ( PROCESS_LM lm  )  [static]

Execute (de)activation of grammars.

Parameters:
lm [i/o] LM processing instance
Returns:
TRUE if at least one grammar has been changed, or FALSE if no grammar has changed its status.

Definition at line 555 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.

Parameters:
dfa_file [in] dfa file name
dict_file [in] dict file name
lm [i/o] LM processing instance

Definition at line 786 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.

Parameters:
lm [i/o] LM processing instance

Definition at line 883 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.

Parameters:
root [in] root pointer of grammar list

Definition at line 986 of file multi-gram.c.

Referenced by j_process_lm_free().

Here is the caller graph for this function:


Generated on Tue Dec 18 16:01:19 2007 for Julius by  doxygen 1.5.4