Data Structures | Typedefs | Functions
gfsmTrain.h File Reference

transducer training from (input,output) string pairs More...

#include <gfsmAutomaton.h>
#include <gfsmUtils.h>
Include dependency graph for gfsmTrain.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gfsmTrainer
 top-level type for automaton training data and options More...
struct  gfsmTrainConfig_
 low-level type for gfsm_automaton_train() computation state More...

Typedefs

typedef struct gfsmTrainConfig_ gfsmTrainConfig
 low-level type for gfsm_automaton_train() computation state
typedef GPtrArray gfsmTrainPath
 low-level type for a successful training-path: GPtrArray* of gfsmTrainConfig*

Functions

gfsmTrainergfsm_trainer_new (gfsmAutomaton *fst)
void gfsm_trainer_free (gfsmTrainer *trainer, gboolean free_fst)
gfsmAutomatongfsm_trainer_automaton (gfsmTrainer *trainer, gboolean steal)
void gfsm_trainer_train (gfsmTrainer *trainer, gfsmLabelVector *input, gfsmLabelVector *output)

Detailed Description

Typedef Documentation

typedef GPtrArray gfsmTrainPath

Function Documentation

gfsmTrainer* gfsm_trainer_new ( gfsmAutomaton fst)

allocate a new gfsmTrainer for training source FST fst

Parameters
fstautomaton to be trained: it will be destructively altered by this call (weights changed to indices)
Returns
new gfsmTrainer
void gfsm_trainer_free ( gfsmTrainer trainer,
gboolean  free_fst 
)

free a gfsmTrainer

Parameters
free_fstif true, the underlying FST will also be freed if still present.
gfsmAutomaton* gfsm_trainer_automaton ( gfsmTrainer trainer,
gboolean  steal 
)

extract an automaton representing the training counts from a gfsmTrainer trainer.

Parameters
trainertrainer from which to extract FST topology and counts
stealif true, trainer->fst will be used directly, invalidating trainer for any futher calls except for gfsm_trainer_free().
Returns
modified trainer->fst if steal is true, otherwise a clone whose weights are counts as stored in trainer->counts
void gfsm_trainer_train ( gfsmTrainer trainer,
gfsmLabelVector input,
gfsmLabelVector output 
)

transducer weight-training utility: count successful paths in training FST for the i/o pair (input, output), updating trainer->counts corresponding to fst arc- and final-weights. On completion, each count is the (real)-sum of its original value and the number of occurrences of the corresponding arc (rsp. final state) in any successful path in fst with labels (input, output). May be run multiple times on the same trainer to add counts for multiple (input, output) pairs.

Parameters
trainertransducer trainer, which should have been initialized as by gfsm_trainer_new()
inputinput labels (lower)
outputoutput labels (upper)