SPRAAK
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Typedefs | Enumerations | Functions | Variables
API_LowLvl::lib::cwr::lm
+ Collaboration diagram for API_LowLvl::lib::cwr::lm:

Data Structures

union  _Union1_CWR_LM_CACHE_
 
struct  SprCwrHashP2XEl
 
struct  SprCwrHashP2X
 
struct  SprCwrLmcHashEl
 
union  SprCwrLMCacheElX
 trick to allow fast copies More...
 
struct  SprCwrLMCacheTbl
 
struct  SprCwrLmcHashTbl
 
struct  SprCwrSearchLmcHash
 
struct  SprCwrLMExtSM
 sub-model info More...
 
struct  SprCwrLMExtWI
 word info More...
 
struct  SprCwrLMExtESB
 the actual word strings stored per command in a large array More...
 
struct  SprCwrLMExt
 
struct  spr_t_cwr_lm_instance_ext
 
struct  SprCwrFsgWarc
 hash table entry: {state,wid} -> this struct More...
 
struct  SprCwrFsgMarc
 list of sub-models for given FSG-node More...
 
union  _Union1_CWR_LM_FSG_
 
struct  SprCwrFsgSmwh
 hash table entry: {submod,wid} -> this struct More...
 
struct  SprCwrFsgState
 
struct  spr_t_cwr_fsg_sm_hdr
 common header for the sub-model structures More...
 
struct  spr_t_cwr_fsg_fsg
 a FSG (sub)model More...
 
struct  spr_t_cwr_fsg_ngram
 an N-gram sub-model More...
 
struct  spr_t_cwr_fsg_elm
 a sub-model (other type of LM) More...
 
union  _Union2_CWR_LM_FSG_
 
struct  SprCwrFsgSm
 a sub-model More...
 
struct  SprCwrFsg
 
struct  SprCwrFsgSmFsgi
 interface to a FSG sub-model More...
 
struct  SprCwrFsgSmElmi
 interface to a sub-model (other type of LM) More...
 
struct  SprCwrLMStrRead
 
struct  SprCwrLMWordHdr
 
struct  SprCwrLMInstance_
 
struct  SprCwrLMInterface
 
struct  SprCwrLMStd32SQ
 
struct  SprCwrLMStd
 

Typedefs

typedef SprCwrLmcHashElSprCwrLmcHashElPtr
 
typedef struct SprCwrLMDump_t SprCwrLMDump
 
typedef float(* _FuncPtr1_CWR_LM_EXT_ )(const SprCwrLMInstance *lm, const SprLMContext *lmc, int wndx)
 
typedef float(* _FuncPtr2_CWR_LM_EXT_ )(SprCwrLMInstance *lm, const SprLMContext *lmc, SprLMContext *lmc_next, SprCwrLMWord *wrd)
 
typedef SprCwrLMWord *(* _FuncPtr3_CWR_LM_EXT_ )(const SprCwrLMInstance *lm, const SprLMContext *lmc, SprCwrLMWord *wrd)
 
typedef float *(* _FuncPtr4_CWR_LM_EXT_ )(const SprCwrLMInstance *lm, const SprLMContext *lmc, float *all_probs, SprCwrLMWord *wrd)
 
typedef int(* _FuncPtr5_CWR_LM_EXT_ )(SprCwrLMInstance *lm, unsigned int action,...)
 
typedef float(* _FuncPtr1_CWR_LM_INTERFACE_ )(const SprCwrLMInstance *lm, const SprLMContext *lmc, int wndx)
 
typedef float(* _FuncPtr2_CWR_LM_INTERFACE_ )(SprCwrLMInstance *lm, const SprLMContext *lmc, SprLMContext *lmc_next, SprCwrLMWord *wrd)
 
typedef SprCwrLMWord *(* _FuncPtr3_CWR_LM_INTERFACE_ )(const SprCwrLMInstance *lm, const SprLMContext *lmc, SprCwrLMWord *wrd)
 
typedef float *(* _FuncPtr4_CWR_LM_INTERFACE_ )(const SprCwrLMInstance *lm, const SprLMContext *lmc, float *all_probs, SprCwrLMWord *wrd)
 
typedef int(* _FuncPtr5_CWR_LM_INTERFACE_ )(SprCwrLMInstance *lm, unsigned int action,...)
 query the LM More...
 
typedef struct SprCwrLMXxx_t SprCwrLMXxx
 

Enumerations

enum  {
  SPR_CWR_LMI_LOADED, SPR_CWR_LMI_NOT_ACTIVE, SPR_CWR_LMI_MULTI_CLASS, SPR_CWR_LMI_TRIV_LM,
  SPR_CWR_LMI_INF_WVIEW, SPR_CWR_LMI_WORST_CASE_INV
}
 the bit-flags 'flags' in the LMInterface structure More...
 
enum  {
  SPR_CWR_LMI_PCALC_DOC, SPR_CWR_LMI_PRINT_LMC, SPR_CWR_LMI_GET_CONTEXT_DEPTH, SPR_CWR_LMI_GET_SLMSP,
  SPR_CWR_LMI_KNOWN_WORD, SPR_CWR_LMI_SET_LM_FAC, SPR_CWR_LMI_GET_LM_FAC, SPR_CWR_LMI_CHECK,
  SPR_CWR_LMI_GET_OPT_DESC, SPR_CWR_LMI_UNINSTALL
}
 
enum  {
  SPR_CWR_LM_NGRAM, SPR_CWR_LM_FSG, SPR_CWR_LM_COMB, SPR_CWR_LM_DUMP,
  SPR_CWR_LM_TEST
}
 

Functions

SprCwrHashP2Xspr_cwr_hash_p2x_alloc (unsigned int max_n_el)
 
SprCwrHashP2XElspr_cwr_hash_p2x_find (const SprCwrHashP2X *htbl, const void *ptr)
 Find a given pointer in the hash table. More...
 
SprCwrHashP2XElspr_cwr_hash_p2x_add (SprCwrHashP2X *htbl, const void *ptr)
 Add a given pointer in the hash table. More...
 
void spr_cwr_lm_cache_init (SprCwrSearchLmcHash *search_lmc_hash)
 
SprCwrHashP2Xspr_cwr_lm_cache_check (const SprCwrSearchLmcHash *search_lmc_hash)
 
SprCwrHashP2Xspr_lm_cache_check_fst (const SprCwrSearchLmcHash *search_lmc_hash)
 
void spr_cwr_lmc_hash_lmcr_free (SprCwrSearchLmcHash *search_lmc_hash)
 
unsigned int spr_cwr_lmc_hash_clear (unsigned int *lost_cnt, SprCwrSearchLmcHash *search_lmc_hash)
 
void spr_cwr_lm_cache_clear (SprCwrSearchLmcHash *search_lmc_hash, int reset_counters)
 
int spr_cwr_lmc_hash_resize (SprCwrSearchLmcHash *search_lmc_hash, unsigned int size)
 
int spr_cwr_lm_cache_resize (SprCwrSearchLmcHash *search_lmc_hash, unsigned int size)
 
int spr_cwr_lmc_hash_lm_install (SprCwrSearchLmcHash *search_lmc_hash, const SprCwrSRMDesc *srm_desc, void *lm, const SprCwrSLex *slex, const int *const *word_sets)
 
int spr_cwr_lmc_hash_lm_uninstall (SprCwrSearchLmcHash *search_lmc_hash)
 Uninstall the LM (close interface to it). More...
 
void spr_cwr_lmc_hash_execute_release (SprCwrLmcHashEl *lmc_hash, SprCwrSearchLmcHash *search_lmc_hash)
 
void spr_cwr_lmc_hash_execute_release0 (SprCwrLmcHashEl *lmc_hash, SprCwrSearchLmcHash *search_lmc_hash)
 
float spr_cwr_mx_wset_prob (int word_id, const SprCwrLmcHashEl *lmc_hash, SprCwrSearchLmcHash *search_lmc_hash)
 
float spr_mx_wset_prob_fst (int word_id, const SprCwrLmcHashEl *lmc_hash, SprCwrSearchLmcHash *search_lmc_hash)
 
SprCwrLmcHashElspr_cwr_lmc_hash_add (const SprLMContext *lmc, SprCwrSearchLmcHash *search_lmc_hash)
 
void spr_cwr_lmc_hash_cond_release (SprLMContext *lmc, SprCwrSearchLmcHash *search_lmc_hash)
 
const LMCacheEl * spr_cwr_lm_cache_query (SprCwrLMWord *wrd, const SprCwrLmcHashEl *lmc_hash, SprCwrSearchLmcHash *search_lmc_hash)
 
SprCwrLMExtspr_cwr_lm_ext_free (SprCwrLMExt *ext)
 
void spr_cwr_lm_ext_lmcr (SprCwrLMInstance *lm, const SprLMContext *lmc)
 
int spr_cwr_lm_ext_uninstall (SprCwrLMInterface *lmi, SprCwrLMInstance *lm_data)
 
float * spr_cwr_lm_ext_read_wdsf (float **wdsf_base, const char *fname, SprCwrLMStrRead *io, const SprStrHashTbl *wlst, const SprCwrLMExt *ext)
 
SprCwrLMExtspr_cwr_lm_ext_read (const char *ext_fname, const char *wdsf_fname, SprCwrLMStrRead *io, const SprStrHashTbl *wlst, int *eos_ndx_ptr, double prob_sf)
 
int * spr_cwr_lm_ext_wxlat (const SprCwrSLex *lex, const SprStrHashTbl *whash_main, const SprStrHashTbl *whash_ext, int check_lvl, int closed_voc)
 
int spr_cwr_lm_ext_install (SprCwrLMInterface *lmi, SprCwrLMInstance *lm_data, SprCwrLMExt *ext, const SprStrHashTbl *whash_main, const SprCwrSLex *lex, int check_lvl, int closed_voc)
 
SprCwrFsgspr_cwr_fsg_free (SprCwrFsg *lm)
 Free all data corresponding to the LM. Return NULL. More...
 
int spr_cwr_fsg_uninstall (SprCwrLMInterface *lmi, SprCwrLMInstance *lm_data)
 
int spr_cwr_fsg_write (SprStream *fd, const SprCwrFsg *lm)
 
int spr_cwr_fsg_install (SprCwrLMInterface *lmi, SprCwrLMInstance *lm_data, unsigned int sz_lm_data, const SprCwrFsg *lm, const SprCwrSLex *lex)
 
SprCwrFsgspr_cwr_fsg_read (SprCwrFsg *dst, const char *fname, const char *options)
 
SprCwrLMStdspr_cwr_lm_std_free (SprCwrLMStd *lm)
 Free all data corresponding to the LM. Return NULL. More...
 
int spr_cwr_lm_std_uninstall (SprCwrLMInterface *lmi, SprCwrLMInstance *lm_data)
 
int spr_cwr_lm_std_install (SprCwrLMInterface *lmi, SprCwrLMInstance *lm_data, unsigned int sz_lm_data, const SprCwrLMStd *lm, const SprCwrSLex *lex)
 
SprCwrLMStdspr_cwr_lm_std_read (SprCwrLMStd *dst, const char *fname, const char *options)
 

Variables

const SprCwrSRMDesc spr_cwr_srm_desc_lm_dump
 
const int spr_cwr_lm_fsg_offs_sm_id_main
 needed since we don't have descent object yet More...
 
const SprCmdOptDesc spr_cwr_od_fsg []
 
const SprCwrSRMDesc spr_cwr_srm_desc_lm_fsg
 
const SprCwrLMStrRead spr_cwr_empty_lm_str_read
 
const SprCwrLMInterface spr_cwr_empty_lm_interface
 
const SprCmdOptDesc spr_cwr_od_read_lm []
 
const SprCwrSRMDesc spr_cwr_srm_desc_lm_std
 
const SprCwrSRMDesc *const spr_cwr_lm_desc []
 
const char *const spr_cwr_str_lm_desc []
 
const SprCwrSRMDesc spr_cwr_srm_desc_lm_xxx
 

Detailed Description

Typedef Documentation

typedef struct SprCwrLMDump_t SprCwrLMDump
typedef float(* _FuncPtr1_CWR_LM_EXT_)(const SprCwrLMInstance *lm, const SprLMContext *lmc, int wndx)
typedef float(* _FuncPtr2_CWR_LM_EXT_)(SprCwrLMInstance *lm, const SprLMContext *lmc, SprLMContext *lmc_next, SprCwrLMWord *wrd)
typedef SprCwrLMWord*(* _FuncPtr3_CWR_LM_EXT_)(const SprCwrLMInstance *lm, const SprLMContext *lmc, SprCwrLMWord *wrd)
typedef float*(* _FuncPtr4_CWR_LM_EXT_)(const SprCwrLMInstance *lm, const SprLMContext *lmc, float *all_probs, SprCwrLMWord *wrd)
typedef int(* _FuncPtr5_CWR_LM_EXT_)(SprCwrLMInstance *lm, unsigned int action,...)
typedef float(* _FuncPtr1_CWR_LM_INTERFACE_)(const SprCwrLMInstance *lm, const SprLMContext *lmc, int wndx)

calc P(wndx|lmc)

typedef float(* _FuncPtr2_CWR_LM_INTERFACE_)(SprCwrLMInstance *lm, const SprLMContext *lmc, SprLMContext *lmc_next, SprCwrLMWord *wrd)

calc P(wrd|lmc) + create lmc_next (lmc extended with wrd); wrd serves as a state variable (store the current state between calls when running over all classes a word can map to in the context lmc

typedef SprCwrLMWord*(* _FuncPtr3_CWR_LM_INTERFACE_)(const SprCwrLMInstance *lm, const SprLMContext *lmc, SprCwrLMWord *wrd)

given a word wrd and an existing class index {wrd->hdr.word_ndx,wrd->hdr.class_id}, set the elements in wrd so that the specified LM-prob and LM-context will be set by a subsequent call to (*func_lmcn)()

typedef float*(* _FuncPtr4_CWR_LM_INTERFACE_)(const SprCwrLMInstance *lm, const SprLMContext *lmc, float *all_probs, SprCwrLMWord *wrd)

calculate the LM probabilities for all words for a given LM-context

typedef int(* _FuncPtr5_CWR_LM_INTERFACE_)(SprCwrLMInstance *lm, unsigned int action,...)

query the LM

typedef struct SprCwrLMXxx_t SprCwrLMXxx

Enumeration Type Documentation

anonymous enum

the bit-flags 'flags' in the LMInterface structure

Enumerator
SPR_CWR_LMI_LOADED 

LM is loaded (and linked)

SPR_CWR_LMI_NOT_ACTIVE 

LM is not active; is a user flag; e.g. LM is non active in isolated word recognition mode

SPR_CWR_LMI_MULTI_CLASS 

words can map to a multiple classes (the reverse, each word maps to one class, allows for a somewhat faster decoding)

SPR_CWR_LMI_TRIV_LM 

unigram (or null grammar) LM, i.e. there is only one LM-context

SPR_CWR_LMI_INF_WVIEW 

the LM has an infinite word view (no correct restart possible from the last N words only)

SPR_CWR_LMI_WORST_CASE_INV 
anonymous enum

the possible actions for the 'func_lmcq' function in the LMInterface structure

Enumerator
SPR_CWR_LMI_PCALC_DOC 

find a given word {wndx,class_id} in the given context, and output information on the probability calculation; returns the total number fall-back steps needed to calculate the probability of the word (a value of -1 indicates an error, e.g. a terminal context); and optionally the depth on which the word was found (typically LMI_GET_CONTEXT_DEPTH()+1) and the probability optionally, all steps are documented (printed out) – note: the str_xxx arguments must only be specified when fd is not NULL (const LMContext *lmc,LMWord *wrd,int *depth,float *prob,FILE *fd,const char *str_open,const char *str_step_sep,const char *str_close)

SPR_CWR_LMI_PRINT_LMC 

print the LM-context in a readable format (single line) – uses wrd for scratch space (const LMContext *lmc,LMWord *wrd,FILE *fd)

SPR_CWR_LMI_GET_CONTEXT_DEPTH 

return the depth of the context, e.g. the number of words in the N-gram context or the number of sub-models opened in a FSG (a return value of -1 means a dead LM context) (const LMContext *lmc)

SPR_CWR_LMI_GET_SLMSP 

get the static LM smearing prob (scaled according to last set 'Cost_A' factor) (LMWord *wrd,float *prob)

SPR_CWR_LMI_KNOWN_WORD 

check if the given word (string) is known to the LM (const char *wrd)

SPR_CWR_LMI_SET_LM_FAC 

set the LM scaling factor (float Cost_A,float Cost_C)

SPR_CWR_LMI_GET_LM_FAC 

get the current LM scaling factor (float *Cost_A,float *Cost_C)

SPR_CWR_LMI_CHECK 

check the LM resources for error (e.g. damaged by some memory leak) (void)

SPR_CWR_LMI_GET_OPT_DESC 

get the structure that describes the options for loading the LM (const OptDesc** od_ret)

SPR_CWR_LMI_UNINSTALL 

convenient method to call the uninstall handler

(LMInterface *lmi)

anonymous enum
Enumerator
SPR_CWR_LM_NGRAM 
SPR_CWR_LM_FSG 
SPR_CWR_LM_COMB 
SPR_CWR_LM_DUMP 
SPR_CWR_LM_TEST 

Function Documentation

SprCwrHashP2X* spr_cwr_hash_p2x_alloc ( unsigned int  max_n_el)

Allocate a hash table to store/check (1 or 2) properties of something that is referred to by a pointer. Everything is allocated in single monolithic block, and hence should be freed with a call to spr_free().

SprCwrHashP2XEl* spr_cwr_hash_p2x_find ( const SprCwrHashP2X htbl,
const void *  ptr 
)

Find a given pointer in the hash table.

SprCwrHashP2XEl* spr_cwr_hash_p2x_add ( SprCwrHashP2X htbl,
const void *  ptr 
)

Add a given pointer in the hash table.

void spr_cwr_lm_cache_init ( SprCwrSearchLmcHash search_lmc_hash)

First time initialisation of the LM-context hash and LM-cache data structures.

SprCwrHashP2X* spr_cwr_lm_cache_check ( const SprCwrSearchLmcHash search_lmc_hash)

Check the consistency of the LM-cache data structures. If there are no errors, a hash table is returned which contains all LmcHash elements with their corresponding 'usage_cnt' in slot 0 and (0) in slot 1. These counts can then be checked by the calling process.

SprCwrHashP2X* spr_lm_cache_check_fst ( const SprCwrSearchLmcHash search_lmc_hash)

Check the consistency of the LM-cache data structures. If there are no errors, a hash table is returned which contains all 'LmcHash' elements with their corresponding 'usage_cnt' in slot 0 and (0) in slot 1. These counts can then be checked by the calling process.

void spr_cwr_lmc_hash_lmcr_free ( SprCwrSearchLmcHash search_lmc_hash)

Release all currently unused LM-context. Must only be called when search_lmc_hash->lmi.func_lmcr != NULL!

unsigned int spr_cwr_lmc_hash_clear ( unsigned int *  lost_cnt,
SprCwrSearchLmcHash search_lmc_hash 
)

Free the running LM-context elements and reset (but do not free) the main hash table. Does NOT imply a lm_cache_clear() call; in other words, a call to lmc_hash_clear() should be followed by a call to lm_cache_clear() or lm_cache_resize().

Returns
The amount of memory that was released.
void spr_cwr_lm_cache_clear ( SprCwrSearchLmcHash search_lmc_hash,
int  reset_counters 
)

Clear (but do not free) the content of the LM-cache. If the reset_counters flag is set, all LM-lmc_hash hashing counters are also reset, assuring that a next counter overrun will take a very long time.

int spr_cwr_lmc_hash_resize ( SprCwrSearchLmcHash search_lmc_hash,
unsigned int  size 
)

Set/change the size of the LM-context hashing. A size of 0 will free the hash table. Note1: The size is an indicative value: it will be increased to the first prime number. Note2: May only be called if there are no active LM-contexts! Note3: After a call to this functions the LM-cache must be cleared either by a call to lm_cache_clear() or lm_cache_resize()

Returns
(-1) on error, 0 otherwise.
int spr_cwr_lm_cache_resize ( SprCwrSearchLmcHash search_lmc_hash,
unsigned int  size 
)

Set/change the size of the LM-cache. A size of 0 will free the cache table. Note1: The size is an indicative value: it will be divided by the number of ways in the cache and then increased to the first prime number. Note2: The LM-cache is cleared by this operation as well.

Returns
-1 on error, 0 otherwise.
int spr_cwr_lmc_hash_lm_install ( SprCwrSearchLmcHash search_lmc_hash,
const SprCwrSRMDesc srm_desc,
void *  lm,
const SprCwrSLex slex,
const int *const *  word_sets 
)

Install the LM (open interface to it) and set a new word_set xlat table (translates negative word id's into multiple words).

int spr_cwr_lmc_hash_lm_uninstall ( SprCwrSearchLmcHash search_lmc_hash)

Uninstall the LM (close interface to it).

void spr_cwr_lmc_hash_execute_release ( SprCwrLmcHashEl lmc_hash,
SprCwrSearchLmcHash search_lmc_hash 
)

Release a given recombination history info block. First the 'usage_cnt' is decreased by one (by means of the lmc_hash_check_release() macro). If the info block is no longer used, it is removed with a call to this function.
Hence, is should be used in the combination:

if(lmc_hash_check_release(lmc_hash))
{lmc_hash_execute_release(lmc_hash,&my_search_struct->lmc_hash);
lmc_hash = NULL;
}
Note
release_lmc_hash_execute() can be a macro.
void spr_cwr_lmc_hash_execute_release0 ( SprCwrLmcHashEl lmc_hash,
SprCwrSearchLmcHash search_lmc_hash 
)

Same as lmc_hash_execute_release(), except that non xxx_lmcr() function will be called on behalf of this context.

float spr_cwr_mx_wset_prob ( int  word_id,
const SprCwrLmcHashEl lmc_hash,
SprCwrSearchLmcHash search_lmc_hash 
)
float spr_mx_wset_prob_fst ( int  word_id,
const SprCwrLmcHashEl lmc_hash,
SprCwrSearchLmcHash search_lmc_hash 
)
SprCwrLmcHashEl* spr_cwr_lmc_hash_add ( const SprLMContext *  lmc,
SprCwrSearchLmcHash search_lmc_hash 
)

Add a given recombination history info block to the set of used ones. If the given word sequence already exists, the usage count is updated, and the address of the block is returned. Otherwise, a new block is created and added to the hash table and the usage count is set to 1. "Note:" The first element in the lmc array is the discriminative length.

void spr_cwr_lmc_hash_cond_release ( SprLMContext *  lmc,
SprCwrSearchLmcHash search_lmc_hash 
)

Check if the given LM-context is available in the hash table. If not, release the context.

Note
This routine may only be called when there is a valid release handler available (search_lmc_hash->lmi.func_lmcr!=NULL)!
const LMCacheEl* spr_cwr_lm_cache_query ( SprCwrLMWord *  wrd,
const SprCwrLmcHashEl lmc_hash,
SprCwrSearchLmcHash search_lmc_hash 
)

Get probability and prepare (reserve) a lmcn_hash. The new lmc_hash should be attached to a token (usage_cnt is updated) or its 'usage_cnt' should be updated and when no longer needed, the context should be releases (see the 'lmc_hash_check_release' macro for more details).

SprCwrLMExt* spr_cwr_lm_ext_free ( SprCwrLMExt ext)
void spr_cwr_lm_ext_lmcr ( SprCwrLMInstance *  lm,
const SprLMContext *  lmc 
)

The LMxxx_lmcr() function in case extensions are loaded on top of the base LM. This will most likely not work!!!

int spr_cwr_lm_ext_uninstall ( SprCwrLMInterface lmi,
SprCwrLMInstance *  lm_data 
)

Uninstall the LM from an application space. Returns (-1) on error and 0 otherwise.

float* spr_cwr_lm_ext_read_wdsf ( float **  wdsf_base,
const char *  fname,
SprCwrLMStrRead io,
const SprStrHashTbl wlst,
const SprCwrLMExt ext 
)

Read word dependent LM scale factors (wdsf) as part of the LM-extensions. Can work without the LM-extensions as well (ext==NULL). The unshifted array is returned in wdsf_base. Returns the shifted scaling-array (or NULL on error).

SprCwrLMExt* spr_cwr_lm_ext_read ( const char *  ext_fname,
const char *  wdsf_fname,
SprCwrLMStrRead io,
const SprStrHashTbl wlst,
int *  eos_ndx_ptr,
double  prob_sf 
)
int* spr_cwr_lm_ext_wxlat ( const SprCwrSLex lex,
const SprStrHashTbl whash_main,
const SprStrHashTbl whash_ext,
int  check_lvl,
int  closed_voc 
)

Allocate + initialize the word index translation table, i.e. a table that converts the word numbering as used by the recognizer (defined by the sorted lexicon lex) to word numbers used by the LM (defined by whash_main and the optional whash_ext). The word numbering is directly derived from the position of the words in the optional whash_ext hash table (wrd_nr=~position) and main whash_main hash table (wrd_nr=position). Unknown words are mapped to the index of the word '<UNK>' in the LM or to the index (-1) if there is no word '<UNK>' in the LM.

Furthermore, if an empty lex structure lex is given, the lexicon is derived from the LM.

Returns NULL on error, and the 'wxlat' array otherwise (shifted by NR_SPECIAL_LM_CLASSES elements).

int spr_cwr_lm_ext_install ( SprCwrLMInterface lmi,
SprCwrLMInstance *  lm_data,
SprCwrLMExt ext,
const SprStrHashTbl whash_main,
const SprCwrSLex lex,
int  check_lvl,
int  closed_voc 
)

Install the LM-extensions in an application space.

Note
None of the base LM routines specified in lmi should try to remap word indices, all routines will be called with the LM word indices (remapping is done by the LM extensions). If special versions of the routines are needed to disable this mapping, the appropriate function pointers must be set in lmi before calling the LMext_install() routine.
Returns
(-1) on error and 0 otherwise.
SprCwrFsg* spr_cwr_fsg_free ( SprCwrFsg lm)

Free all data corresponding to the LM. Return NULL.

int spr_cwr_fsg_uninstall ( SprCwrLMInterface lmi,
SprCwrLMInstance *  lm_data 
)

Uninstall the LM from an application space. Returns (-1) on error and 0 otherwise.

int spr_cwr_fsg_write ( SprStream fd,
const SprCwrFsg lm 
)
int spr_cwr_fsg_install ( SprCwrLMInterface lmi,
SprCwrLMInstance *  lm_data,
unsigned int  sz_lm_data,
const SprCwrFsg lm,
const SprCwrSLex lex 
)

Install the LM in an application space. If <lex->word_str> equals the NULL pointer, a sorted lexicon is made based on the words in the LM. Returns (-1) on error and 0 otherwise.

SprCwrFsg* spr_cwr_fsg_read ( SprCwrFsg dst,
const char *  fname,
const char *  options 
)
SprCwrLMStd* spr_cwr_lm_std_free ( SprCwrLMStd lm)

Free all data corresponding to the LM. Return NULL.

int spr_cwr_lm_std_uninstall ( SprCwrLMInterface lmi,
SprCwrLMInstance *  lm_data 
)

Uninstall the LM from an application space. Returns (-1) on error and 0 otherwise.

int spr_cwr_lm_std_install ( SprCwrLMInterface lmi,
SprCwrLMInstance *  lm_data,
unsigned int  sz_lm_data,
const SprCwrLMStd lm,
const SprCwrSLex lex 
)

Install the LM in an application space. If <lex->word_str> equals the NULL pointer, a sorted lexicon is made based on the words in the LM. Returns (-1) on error and 0 otherwise.

SprCwrLMStd* spr_cwr_lm_std_read ( SprCwrLMStd dst,
const char *  fname,
const char *  options 
)

Variable Documentation

const SprCwrSRMDesc spr_cwr_srm_desc_lm_dump
const int spr_cwr_lm_fsg_offs_sm_id_main

needed since we don't have descent object yet

const SprCmdOptDesc spr_cwr_od_fsg[]
const SprCwrSRMDesc spr_cwr_srm_desc_lm_fsg
const SprCwrLMStrRead spr_cwr_empty_lm_str_read
const SprCwrLMInterface spr_cwr_empty_lm_interface
const SprCmdOptDesc spr_cwr_od_read_lm[]
const SprCwrSRMDesc spr_cwr_srm_desc_lm_std
const SprCwrSRMDesc* const spr_cwr_lm_desc[]
const char* const spr_cwr_str_lm_desc[]
const SprCwrSRMDesc spr_cwr_srm_desc_lm_xxx