Path discovery & enumeration.
More...
#include <gfsmAutomaton.h>
#include <gfsmPaths.hi>
Go to the source code of this file.
Typedefs |
typedef GPtrArray | gfsmArcPath |
| Type for an automaton arc path (full alignment: GPtrArray of gfsmArc*)
|
gfsmPath Utilities |
#define | gfsm_path_new(sr) gfsm_path_new_full(NULL,NULL,gfsm_sr_one(sr)) |
static gfsmPath * | gfsm_path_new_full (gfsmLabelVector *lo, gfsmLabelVector *hi, gfsmWeight w) |
gfsmPath * | gfsm_path_new_copy (gfsmPath *p1) |
gfsmPath * | gfsm_path_new_append (gfsmPath *p1, gfsmLabelVal lo, gfsmLabelVal hi, gfsmWeight w, gfsmSemiring *sr) |
gfsmPath * | gfsm_path_new_times_w (gfsmPath *p1, gfsmWeight w, gfsmSemiring *sr) |
static void | gfsm_path_push (gfsmPath *p, gfsmLabelVal lo, gfsmLabelVal hi, gfsmWeight w, gfsmSemiring *sr) |
static void | gfsm_path_pop (gfsmPath *p, gfsmLabelVal lo, gfsmLabelVal hi) |
gint | gfsm_path_compare_data (const gfsmPath *p1, const gfsmPath *p2, gfsmSemiring *sr) |
static gfsmPath * | gfsm_path_reverse (gfsmPath *p) |
static void | gfsm_path_free (gfsmPath *p) |
Automaton Serialization: gfsmPath |
#define | _gfsm_paths_to_strings_options gfsmPathsToStringsOptions_ |
typedef struct
gfsmPathsToStringsOptions_ | gfsmPathsToStringsOptions |
| Utility struct for gfsm_paths_to_strings()
|
gfsmSet * | gfsm_automaton_paths (gfsmAutomaton *fsm, gfsmSet *paths) |
gfsmSet * | gfsm_automaton_paths_full (gfsmAutomaton *fsm, gfsmSet *paths, gfsmLabelSide which) |
gfsmSet * | _gfsm_automaton_paths_r (gfsmAutomaton *fsm, gfsmSet *paths, gfsmLabelSide which, gfsmStateId q, gfsmPath *path) |
GSList * | gfsm_paths_to_strings (gfsmSet *paths, gfsmAlphabet *abet_lo, gfsmAlphabet *abet_hi, gfsmSemiring *sr, gboolean warn_on_undefined, gboolean att_style, GSList *strings) |
gboolean | _gfsm_paths_to_strings_foreach_func (gfsmPath *path, gpointer value_dummy, gfsmPathsToStringsOptions *opts) |
GString * | gfsm_path_to_gstring (gfsmPath *path, GString *gs, gfsmAlphabet *abet_lo, gfsmAlphabet *abet_hi, gfsmSemiring *sr, gboolean warn_on_undefined, gboolean att_style) |
char * | gfsm_path_to_string (gfsmPath *path, gfsmAlphabet *abet_lo, gfsmAlphabet *abet_hi, gfsmSemiring *sr, gboolean warn_on_undefined, gboolean att_style) |
Automaton Serialization: Viterbi |
#define | gfsm_viterbi_trellis_paths(trellis, paths) gfsm_viterbi_trellis_paths_full((trellis),(paths),gfsmLSUpper) |
#define | gfsm_viterbi_trellis_bestpath(trellis, path) gfsm_viterbi_trellis_bestpath_full((trellis),(path),gfsmLSUpper) |
gfsmSet * | gfsm_viterbi_trellis_paths_full (gfsmAutomaton *trellis, gfsmSet *paths, gfsmLabelSide which) |
gfsmPath * | gfsm_viterbi_trellis_bestpath_full (gfsmAutomaton *trellis, gfsmPath *path, gfsmLabelSide which) |
void | _gfsm_viterbi_trellis_bestpath_r (gfsmAutomaton *trellis, gfsmPath *path, gfsmLabelSide which, gfsmStateId qid) |
Detailed Description
Macro Definition Documentation
Duplicate a gfsmLabelVector.
- Returns
- dst
Create and return a new empty gfsmPath, specifying semiring.
backwards compatible type alias
Extract upper side of all paths from a Viterbi trellis.
Returns a gfsmSet whose elements are (gfsmPath*)s. allocated with gfsm_slice_new(). It is the caller's responsibility to free the returned objects.
- Returns
- paths if non-NULL, otherwise a new gfsmSet*.
Extract the upper-side of the best path from a Viterbi trellis.
- Returns
- path if non-NULL, otherwise a new gfsmPath*.
Typedef Documentation
Function Documentation
Copy gfsmLabelVector.
- Returns
- dst
Reverse a gfsmLabelVector.
- Returns
- v
Create and return a new gfsmPath, specifying components If either of lo or hi are NULL, a new vector will be created.
Create and return a new gfsmPath, appending to an existing path
Create and return a new gfsmPath as a copy of an existing gfsmPath with weight multiplied by w
3-way path comparison function.
static void gfsm_path_free |
( |
gfsmPath * |
p | ) |
|
|
inlinestatic |
Serialize a gfsmAutomaton to a set of (gfsmPath*)s. Really just a wrapper for gfsm_automaton_paths_full()
- Parameters
-
fsm | Acyclic automaton to be serializd |
paths | output set or NULL |
- Returns
- paths if non-NULL, otherwise a new gfsmSet*.
Serialize a gfsmAutomaton to a set of (gfsmPath*)s.
Causes deep recursion for cyclic automata. Returns a gfsmSet whose elements are (gfsmPath*)s. allocated with gfsm_slice_new(). It is the caller's responsibility to free the returned objects.
- Parameters
-
fsm | Acyclic automaton to be serializd |
which | Which side of arc-labels to serialize |
paths | output set or NULL |
- Returns
- paths if non-NULL, otherwise a new gfsmSet*.
Convert a gfsmPathSet to a list of (char*)s. abet_lo and abet_hi should be (gfsmStringAlphabet*)s.
Append string for a single gfsmPath* to a GString, which may be NULL to allocate a new string.
- Returns
- gs if non-NULL, otherwise a new GString*.
- Warning
- it is the caller's responsibility to free the returned GString*.
Allocate and return a new string (char*) for a single gfsmPath*.
- Returns
- new (char*) representing path.
- Warning
- it is the callers responsibility to free the returned char*.
Create and return a new gfsmArcPath*
Create and return a new gfsmArcPath* by appending a to an existing path p1
Copy a gfsmArcPath* src to dst
- Returns
- dst
Create and return a new gfsmArcPath* by duplicating an old one
void gfsm_arcpath_list_free |
( |
GSList * |
arcpaths | ) |
|
Destroy a GSList of gfsmArcPath*
Serialize a gfsmAutomaton to a list of (gfsmArcPath*)s. Causes deep recursion for cyclic automata. Returns a GSList whose element data are (gfsmArcPath*)s. It is the caller's responsibility to free the returned objects. The pointer data in the returned (gfsmArcPath*)s are (gfsmArc*)s into fsm, and will be freed with that automaton for all but the final pointer of each gfsmArcPath, and the final element is a gpointer-encoded gfsmWeight representing the final weight associated with the arc path; extract it e.g. with gfsm_ptr2weight(arcpath->data[arcpath->len-1]).
- Parameters
-
fsm | Acyclic automaton to be serializd |
- Returns
- a new GSList of (gfsmArcPath*)s
void _gfsm_automaton_arcpaths_r |
( |
gfsmAutomaton * |
fsm, |
|
|
gfsmStateId |
qid, |
|
|
GSList * |
path, |
|
|
guint |
path_len, |
|
|
GSList ** |
paths, |
|
|
GSList ** |
nodes |
|
) |
| |
Recursive guts for gfsm_automaton_arcpaths().
- Parameters
-
fsm | automaton being serialized |
qid | current state in automaton search |
path | path to current state (GSList of gfsmArc*), reversed |
path_len | length of current path (for cyclicity check) |
paths | GSList of *(GSList of gfsmArc*): all complete paths, reversed |
nodes | GSList of *(GSList of gfsmArc*): all allocated nodes |
Append string for a single gfsmArcPath* to a GString, which may be NULL to allocate a new string.
- Returns
- gs if non-NULL, otherwise a new GString*.
- Warning
- it is the caller's responsibility to free the returned GString*.
Allocate and return a new string (char*) for a single gfsmArcPath*.
- Returns
- new (char*) representing path.
- Warning
- it is the callers responsibility to free the returned char*.
Stringifily a whole GSList of (gfsmArcPath*)s.
- Returns
- GSList of char*
Extract all paths from a Viterbi trellis.
Returns a gfsmSet whose elements are (gfsmPath*)s. allocated with gfsm_slice_new(). It is the caller's responsibility to free the returned objects.
- Returns
- paths if non-NULL, otherwise a new gfsmSet*.
Extract the best path from a Viterbi trellis.
- Returns
- path if non-NULL, otherwise a new gfsmPath*.
Guts for gfsm_viterbi_trellis_*path*()