Data Structures | Typedefs | Variables
gfsmxlCascadeLookup.h File Reference

First stab at transducer cascade lookup routines. More...

#include <gfsmxlCascade.h>
#include <gfsmxlCLCFib.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gfsmxlCascadeLookupBacktrace_
 struct for cascade lookup heap element backtrace "pointers" More...
struct  gfsmxlCascadeLookupConfig_
 struct for cascade lookup heap element data More...
struct  gfsmxlCascadeLookup
 Persistent type for best-first cascade lookups. More...

Typedefs

typedef struct gfsmxlCLCFibHeap gfsmxlFibHeap
 Alias for 'struct gfsmxlCLCFibHeap'.
typedef struct
gfsmxlCascadeLookupBacktrace_ 
gfsmxlCascadeLookupBacktrace
 struct for cascade lookup heap element backtrace "pointers"
typedef struct
gfsmxlCascadeLookupConfig_ 
gfsmxlCascadeLookupConfig
 struct for cascade lookup heap element data
typedef GSList gfsmxlCascadeLookupConfigList
 Singly-linked list of gfsmxlCascadeLookupConfig elements. Used by gfsmxlCascadeLookup.configs.
typedef GPtrArray gfsmxlPathArray
 GPtrArray of gfsmPath elements with a shared gfsmPath.lo field Used by gfsmxl_cascade_nbest_paths()

Functions

Constructors etc.
static gfsmxlCascadeLookupgfsmxl_cascade_lookup_new_full (gfsmxlCascade *csc, gfsmWeight max_w, guint max_paths, guint max_ops)
static gfsmxlCascadeLookupgfsmxl_cascade_lookup_new (void)
static void gfsmxl_cascade_lookup_set_cascade (gfsmxlCascadeLookup *cl, gfsmxlCascade *csc)
static void gfsmxl_cascade_lookup_free (gfsmxlCascadeLookup *cl)
gfsmxlCascadeLookup API
gfsmAutomatongfsmxl_cascade_lookup_nbest (gfsmxlCascadeLookup *cl, gfsmLabelVector *input, gfsmAutomaton *result)
gfsmxlPathArraygfsmxl_cascade_lookup_nbest_paths (gfsmxlCascadeLookup *cl, gfsmLabelVector *input, gfsmxlPathArray *paths)
gfsmxlCascadeLookup: Low-level and Debug Utilities
void gfsmxl_cascade_lookup_reset (gfsmxlCascadeLookup *cl)
static gfsmAutomatongfsmxl_cascade_lookup_nbest_prepare_ (gfsmxlCascadeLookup *cl, gfsmAutomaton *result)
static gfsmxlCascadeLookupConfiggfsmxl_cascade_lookup_ensure_config (gfsmxlCascadeLookup *cl, gfsmxlCascadeLookupConfig *cfg_key)
void gfsmxl_cascade_lookup_nbest_search_ (gfsmxlCascadeLookup *cl, gfsmLabelVector *input)
void gfsmxl_cascade_lookup_nbest_backtrace_ (gfsmxlCascadeLookup *cl, gfsmxlCascadeLookupConfig *cfg, gfsmxlCascadeLookupConfig *nxt, gfsmAutomaton *result)
void gfsmxl_cascade_lookup_nbest_backtrace_path_ (gfsmxlCascadeLookup *cl, gfsmxlCascadeLookupConfig *cfg, gfsmPath *p)
gfsmAutomatongfsmxl_cascade_lookup_nbest_debug (gfsmxlCascadeLookup *cl, gfsmLabelVector *input, gfsmAutomaton *result)
static gfsmxlPathArraygfsmxl_patharray_new (guint n_paths)
static void gfsmxl_patharray_free (gfsmxlPathArray *paths)
void gfsmxl_patharray_clear (gfsmxlPathArray *paths)
gfsmxlCascadeLookupConfig: Low-level Utilities
static int gfsmxl_cascade_lookup_config_fh_compare (gfsmxlCascadeLookupConfig *lc1, gfsmxlCascadeLookupConfig *lc2)
guint gfsmxl_cascade_lookup_config_ht_hash (gfsmxlCascadeLookupConfig *lc)
gboolean gfsmxl_cascade_lookup_config_ht_equal (gfsmxlCascadeLookupConfig *lc1, gfsmxlCascadeLookupConfig *lc2)
static gfsmxlCascadeLookupConfiggfsmxl_cascade_lookup_config_new_full (gfsmxlCascade *csc, gfsmxlCascadeStateId qids, guint32 ipos, gfsmStateId oid, gfsmStateId rid, gfsmWeight w, gfsmxlCascadeLookupBacktrace bt)
static gfsmxlCascadeLookupConfiggfsmxl_cascade_lookup_config_new (gfsmxlCascadeLookup *cl)
static void gfsmxl_cascade_lookup_config_copy (gfsmxlCascadeLookupConfig *dst, gfsmxlCascadeLookupConfig *src)
static gfsmxlCascadeLookupConfiggfsmxl_cascade_lookup_config_clone (gfsmxlCascadeLookupConfig *src)
static void gfsmxl_cascade_lookup_config_free_inline (gfsmxlCascadeLookupConfig *lc)
void gfsmxl_cascade_lookup_config_free (gfsmxlCascadeLookupConfig *lc)
Low-level: gfsmxlCascadeLookupConfigList
void gfsmxl_cascade_lookup_config_list_free (gfsmxlCascadeLookupConfigList *lcl)

Variables

const gfsmxlCascadeLookupBacktrace gfsmxl_bt_null

Detailed Description

Typedef Documentation

typedef GPtrArray gfsmxlPathArray

Function Documentation

static gfsmxlCascadeLookup* gfsmxl_cascade_lookup_new_full ( gfsmxlCascade csc,
gfsmWeight  max_w,
guint  max_paths,
guint  max_ops 
)
inlinestatic

Create a new gfsmxlCascadeLookup, specifying initial data (csc will be freed with the returned lookup object)

static gfsmxlCascadeLookup* gfsmxl_cascade_lookup_new ( void  )
inlinestatic

Create a new empty gfsmxlCascadeLookup

static void gfsmxl_cascade_lookup_set_cascade ( gfsmxlCascadeLookup cl,
gfsmxlCascade csc 
)
inlinestatic

(re-)set underlying cascade of a gfsmxlCascadeLookup.

  • frees old cascade, if any
  • csc will be freed with cl
static void gfsmxl_cascade_lookup_free ( gfsmxlCascadeLookup cl)
inlinestatic

Destroy a gfsmxlCascadeLookup. Also frees cl->heap, cl->csc, and its indexed automata

gfsmAutomaton* gfsmxl_cascade_lookup_nbest ( gfsmxlCascadeLookup cl,
gfsmLabelVector input,
gfsmAutomaton result 
)

Lookup first n "best" path(s) for input labels input in cl->csc, and populate result with them. If result is passed as NULL, a new gfsmAutomaton will be created.

Returns
result if non-NULL, otherwise a new gfsmAutomaton.
See Also
gfsmxl_cascade_lookup_nbest_paths()
gfsmxl_cascade_lookup_nbest_search_()
gfsmxl_cascade_lookup_nbest_backtrace_()
gfsmxlPathArray* gfsmxl_cascade_lookup_nbest_paths ( gfsmxlCascadeLookup cl,
gfsmLabelVector input,
gfsmxlPathArray paths 
)

Lookup first n "best" path(s) for input labels input in cl->csc, and prepend them to the gfsmxlPathArray* paths. If paths is passed as NULL, a new gfsmxlPathArray* will be created and returned.

Returns
list of n-best paths prepended to paths.
  • Each path returned has its lo field set to input
  • Each path returned has its own hi field allocated
  • Implicitly clears paths
See Also
gfsmxl_cascade_lookup_nbest()
gfsmxl_cascade_lookup_nbest_search_()
gfsmxl_cascade_lookup_nbest_backtrace_path_()
void gfsmxl_cascade_lookup_reset ( gfsmxlCascadeLookup cl)

Resets state of a gfsmxlCascadeLookup, preparing it for another lookup

  • implicitly called by gfsm_cascade_lookup_nbest()
static gfsmAutomaton* gfsmxl_cascade_lookup_nbest_prepare_ ( gfsmxlCascadeLookup cl,
gfsmAutomaton result 
)
inlinestatic

Create or clear automaton result for use with gfsmxl_cascade_lookup_nbest()

Returns
cleared result if specified, otherwise a new gfsmAutomaton
static gfsmxlCascadeLookupConfig* gfsmxl_cascade_lookup_ensure_config ( gfsmxlCascadeLookup cl,
gfsmxlCascadeLookupConfig cfg_key 
)
inlinestatic

Get best config matching cfg_tmp (according to gfsmxl_lookup_config_ht_hash(), gfsmxl_lookup_config_ht_equal()). Updates administrative data (cl->heap, cl->configs) appropriately.

Parameters
cllookup object
cfg_keyconfiguration to match or create
Returns
NULL if an equal-or-better config is already known to cl, otherwise a clone of cfg_tmp
void gfsmxl_cascade_lookup_nbest_search_ ( gfsmxlCascadeLookup cl,
gfsmLabelVector input 
)

Search guts for gfsmxl_cascade_lookup_nbest(). Performs n-best search, storing only backtraces.

See Also
gfsmxl_cascade_lookup_nbest()
gfsmxl_cascade_lookup_nbest_backtrace_()
void gfsmxl_cascade_lookup_nbest_backtrace_ ( gfsmxlCascadeLookup cl,
gfsmxlCascadeLookupConfig cfg,
gfsmxlCascadeLookupConfig nxt,
gfsmAutomaton result 
)

Backtrace construction guts for gfsmxl_cascade_lookup_nbest(). Expands backtraces for config cfg in cl into result.

See Also
gfsmxl_cascade_lookup_nbest()
gfsmxl_cascade_lookup_nbest_search_()
void gfsmxl_cascade_lookup_nbest_backtrace_path_ ( gfsmxlCascadeLookup cl,
gfsmxlCascadeLookupConfig cfg,
gfsmPath p 
)

Backtrace construction guts for gfsmxl_cascade_lookup_nbest_paths(). Expands backtraces for config cfg in cl into p.

See Also
gfsmxl_cascade_lookup_nbest_paths()
gfsmxl_cascade_lookup_nbest_search_()
gfsmAutomaton* gfsmxl_cascade_lookup_nbest_debug ( gfsmxlCascadeLookup cl,
gfsmLabelVector input,
gfsmAutomaton result 
)

Old version of gfsmxl_cascade_lookup_nbest(), useful for debugging

static gfsmxlPathArray* gfsmxl_patharray_new ( guint  n_paths)
inlinestatic

Create a gfsmxlPathArray, pre-allocating npaths states

static void gfsmxl_patharray_free ( gfsmxlPathArray paths)
inlinestatic

Destroy a gfsmxlPathArray

void gfsmxl_patharray_clear ( gfsmxlPathArray paths)

Clear a gfsmxlPathArray, freeing stored paths (except for gfsmPath.lo fields)

static int gfsmxl_cascade_lookup_config_fh_compare ( gfsmxlCascadeLookupConfig lc1,
gfsmxlCascadeLookupConfig lc2 
)
inlinestatic

Heap-element comparison function for gfsmxlCascadeLookupConfig (inline)

  • Compares only weights and input positions!
  • Behaves basically like the perl code: (lc1->w <=> lc2->w) || (lc2->ipos <=> lc1->ipos)
guint gfsmxl_cascade_lookup_config_ht_hash ( gfsmxlCascadeLookupConfig lc)

Hash function for gfsmxlCascadeLookupConfig; castable to GHashFunc

  • Hashes only (lc->ipos,lc->oid,lc->qids)
gboolean gfsmxl_cascade_lookup_config_ht_equal ( gfsmxlCascadeLookupConfig lc1,
gfsmxlCascadeLookupConfig lc2 
)

Equality predicate for gfsmxlCascadeLookupConfig; castable to GEqualFunc

  • Tests only (lcX->ipos,lcX->oid,lcX->qids)
static gfsmxlCascadeLookupConfig* gfsmxl_cascade_lookup_config_new_full ( gfsmxlCascade csc,
gfsmxlCascadeStateId  qids,
guint32  ipos,
gfsmStateId  oid,
gfsmStateId  rid,
gfsmWeight  w,
gfsmxlCascadeLookupBacktrace  bt 
)
inlinestatic

Allocate a gfsmxlCascadeLookupConfig.

Parameters
cscunderlying cascade
qidsstate ids for the config (will be copied into cfg->qids)
winitial accumulated weight for the config
btconfiguration backtrace data (parent configuration)
static gfsmxlCascadeLookupConfig* gfsmxl_cascade_lookup_config_new ( gfsmxlCascadeLookup cl)
inlinestatic

Allocate a gfsmxlCascadeLookupConfig for cl, including state-id data

static void gfsmxl_cascade_lookup_config_copy ( gfsmxlCascadeLookupConfig dst,
gfsmxlCascadeLookupConfig src 
)
inlinestatic

Copy a ::gfsmCascadeLookupConfig src to dst, which must already be allocated.

Returns
dst
static gfsmxlCascadeLookupConfig* gfsmxl_cascade_lookup_config_clone ( gfsmxlCascadeLookupConfig src)
inlinestatic

Create and return an exact copy of a gfsmxlCascadeLookupConfig src, including state-id data

static void gfsmxl_cascade_lookup_config_free_inline ( gfsmxlCascadeLookupConfig lc)
inlinestatic

Free a gfsmxlCascadeLookupConfig as allocated by one of the gfsmxl_cascade_lookup_config_new() functions, including state-id data (inline version)

void gfsmxl_cascade_lookup_config_free ( gfsmxlCascadeLookupConfig lc)

Free a gfsmxlCascadeLookupConfig, including state-id data (extern version)

void gfsmxl_cascade_lookup_config_list_free ( gfsmxlCascadeLookupConfigList lcl)

Variable Documentation

const gfsmxlCascadeLookupBacktrace gfsmxl_bt_null