Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

multi-gram.h File Reference

Definitions for managing multiple grammars. More...

#include <julius.h>

Include dependency graph for multi-gram.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MAXGRAMNAMELEN   512
 Maximum length of grammar name.
#define MULTIGRAM_DEFAULT   0
 Grammar hook value of no operation.
#define MULTIGRAM_DELETE   1
 Grammar hook value specifying that this grammar is to be deleted.
#define MULTIGRAM_ACTIVATE   2
 Grammar hook value specifying that this grammar is to be activated.
#define MULTIGRAM_DEACTIVATE   3
 Grammar hook value specifying that this grammar is to be deactivated.

Typedefs

typedef __multi_gram__ MULTIGRAM
 Grammar holder.
typedef __gram_list__ GRAMLIST
 List of grammars to be read at startup.

Functions

void multigram_add (DFA_INFO *dfa, WORD_INFO *winfo, char *name)
boolean multigram_delete (int gid)
void multigram_delete_all ()
boolean multigram_exec ()
 Update and re-construct global grammar if needed.
void multigram_activate (int gid)
void multigram_deactivate (int gid)
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_active_num ()
int multigram_get_gram_from_category (int category)


Detailed Description

Definitions for managing multiple grammars.

Author:
Akinobu Lee
Date:
Fri Jul 8 14:47:05 2005
Revision
1.1.1.1

Definition in file multi-gram.h.


Function Documentation

void multigram_add DFA_INFO dfa,
WORD_INFO winfo,
char *  name
 

Add a new grammar to the current list of grammars.

Parameters:
dfa [in] DFA information of the new grammar.
winfo [in] dictionary information of the new grammar.
name [in] name string of the new grammar.

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

Referenced by multigram_read_file().

boolean multigram_delete int  delid  ) 
 

Mark a grammar in the grammar list to be deleted at the next grammar update.

Parameters:
delid [in] grammar id to be deleted
Returns:
TRUE on normal exit, or FALSE if the specified grammar is not found in the grammar list.

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

void multigram_delete_all  ) 
 

Mark all grammars in the grammar list to be deleted at the next grammar update.

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

boolean 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.

Returns:
always TRUE.

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

Referenced by final_fusion(), and main_recognition_loop().

void multigram_activate int  gid  ) 
 

Activate specified grammar in the grammar list. The specified grammar will only be marked as to be activated in the next grammar update timing.

Parameters:
gid [in] grammar ID to be activated

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

void multigram_deactivate int  gid  ) 
 

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().

Parameters:
gid [in] grammar ID to be de-activated

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

void multigram_read_file char *  dfa_file,
char *  dict_file
 

Read in dfa file and dict file, and add them to the grammar list.

Parameters:
dfa_file [in] dfa file name
dict_file [in] dict file name

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

Referenced by multigram_read_all_gramlist().

void multigram_add_gramlist char *  dfafile,
char *  dictfile
 

Add a grammar to the grammar list to be read at startup.

Parameters:
dfafile [in] DFA file
dictfile [in] dictionary file

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

Referenced by final_fusion(), multigram_add_prefix_filelist(), and multigram_add_prefix_list().

void multigram_remove_gramlist  ) 
 

Remove the grammar list to be read at startup.

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

Referenced by opt_parse().

void multigram_read_all_gramlist  ) 
 

Read in all the grammars specified at startup.

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

Referenced by final_fusion().

void multigram_add_prefix_list char *  prefix_list,
char *  cwd
 

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.

Parameters:
prefix_list [in] string that contains comma-separated list of grammar path prefixes
cwd [in] string of current working directory

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

Referenced by opt_parse().

void multigram_add_prefix_filelist char *  listfile  ) 
 

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.

Parameters:
listfile [in] path of the prefix list file

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

Referenced by opt_parse().

int multigram_get_gram_from_category int  category  ) 
 

Get which grammar the given category belongs to.

Parameters:
category word category ID
Returns:
the id of the belonging grammar.

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

Referenced by msock_pass2(), and ttyout_pass2().


Generated on Tue Mar 28 16:18:04 2006 for Julius by  doxygen 1.4.2