PocketSphinx 5prealpha
|
Word graph search implementation. More...
Go to the source code of this file.
Data Structures | |
struct | latlink_list_s |
Linked list of DAG link pointers. More... | |
struct | ps_lattice_s |
Word graph structure used in bestpath/nbest search. More... | |
struct | ps_latlink_s |
Links between DAG nodes. More... | |
struct | ps_latnode_s |
DAG nodes. More... | |
struct | dag_seg_s |
Segmentation "iterator" for backpointer table results. More... | |
struct | ps_latpath_s |
Partial path structure used in N-best (A*) search. More... | |
struct | ps_astar_s |
A* search structure. More... | |
struct | astar_seg_s |
Segmentation "iterator" for A* search results. More... | |
Typedefs | |
typedef struct latlink_list_s | latlink_list_t |
Linked list of DAG link pointers. More... | |
typedef struct dag_seg_s | dag_seg_t |
Segmentation "iterator" for backpointer table results. | |
typedef struct ps_latpath_s | ps_latpath_t |
Partial path structure used in N-best (A*) search. More... | |
typedef struct ps_astar_s | ps_astar_t |
A* search structure. | |
typedef struct astar_seg_s | astar_seg_t |
Segmentation "iterator" for A* search results. | |
Functions | |
ps_lattice_t * | ps_lattice_init_search (ps_search_t *search, int n_frame) |
Construct an empty word graph with reference to a search structure. More... | |
void | ps_lattice_penalize_fillers (ps_lattice_t *dag, int32 silpen, int32 fillpen) |
Insert penalty for fillers. More... | |
void | ps_lattice_delete_unreachable (ps_lattice_t *dag) |
Remove nodes marked as unreachable. More... | |
void | ps_lattice_pushq (ps_lattice_t *dag, ps_latlink_t *link) |
Add an edge to the traversal queue. More... | |
ps_latlink_t * | ps_lattice_popq (ps_lattice_t *dag) |
Remove an edge from the traversal queue. More... | |
void | ps_lattice_delq (ps_lattice_t *dag) |
Clear and reset the traversal queue. More... | |
latlink_list_t * | latlink_list_new (ps_lattice_t *dag, ps_latlink_t *link, latlink_list_t *next) |
Create a new lattice link element. More... | |
char const * | ps_lattice_hyp (ps_lattice_t *dag, ps_latlink_t *link) |
Get hypothesis string after bestpath search. More... | |
ps_seg_t * | ps_lattice_seg_iter (ps_lattice_t *dag, ps_latlink_t *link, float32 lwf) |
Get hypothesis segmentation iterator after bestpath search. More... | |
ps_astar_t * | ps_astar_start (ps_lattice_t *dag, ngram_model_t *lmset, float32 lwf, int sf, int ef, int w1, int w2) |
Begin N-Gram based A* search on a word graph. More... | |
ps_latpath_t * | ps_astar_next (ps_astar_t *nbest) |
Find next best hypothesis of A* on a word graph. More... | |
void | ps_astar_finish (ps_astar_t *nbest) |
Finish N-best search, releasing resources associated with it. More... | |
char const * | ps_astar_hyp (ps_astar_t *nbest, ps_latpath_t *path) |
Get hypothesis string from A* search. More... | |
ps_seg_t * | ps_astar_seg_iter (ps_astar_t *astar, ps_latpath_t *path, float32 lwf) |
Get hypothesis segmentation from A* search. More... | |
Word graph search implementation.
Definition in file ps_lattice_internal.h.
typedef struct latlink_list_s latlink_list_t |
Linked list of DAG link pointers.
Because the same link structure is used for forward and reverse links, as well as for the agenda used in bestpath search, we can't store the list pointer inside latlink_t. We could use glist_t here, but it wastes 4 bytes per entry on 32-bit machines.
typedef struct ps_latpath_s ps_latpath_t |
Partial path structure used in N-best (A*) search.
Each partial path (latpath_t) is constructed by extending another partial path–parent–by one node.
latlink_list_t * latlink_list_new | ( | ps_lattice_t * | dag, |
ps_latlink_t * | link, | ||
latlink_list_t * | next | ||
) |
Create a new lattice link element.
Definition at line 1042 of file ps_lattice.c.
References ps_lattice_s::latlink_list_alloc.
Referenced by ps_lattice_pushq().
void ps_astar_finish | ( | ps_astar_t * | nbest | ) |
Finish N-best search, releasing resources associated with it.
Definition at line 1925 of file ps_lattice.c.
References ps_astar_s::hyps, and ps_astar_s::latpath_alloc.
Referenced by ps_nbest_free().
char const * ps_astar_hyp | ( | ps_astar_t * | nbest, |
ps_latpath_t * | path | ||
) |
Get hypothesis string from A* search.
Definition at line 1804 of file ps_lattice.c.
References dict_real_word(), ps_latpath_s::parent, and ps_lattice_s::search.
Referenced by ps_nbest_hyp().
ps_latpath_t * ps_astar_next | ( | ps_astar_t * | nbest | ) |
Find next best hypothesis of A* on a word graph.
Definition at line 1771 of file ps_lattice.c.
References ps_lattice_s::end, ps_latnode_s::fef, ps_latpath_s::next, ps_latpath_s::node, and ps_latnode_s::sf.
Referenced by ps_nbest_next().
ps_seg_t * ps_astar_seg_iter | ( | ps_astar_t * | astar, |
ps_latpath_t * | path, | ||
float32 | lwf | ||
) |
Get hypothesis segmentation from A* search.
Definition at line 1898 of file ps_lattice.c.
References ps_seg_s::vt.
Referenced by ps_nbest_seg().
ps_astar_t * ps_astar_start | ( | ps_lattice_t * | dag, |
ngram_model_t * | lmset, | ||
float32 | lwf, | ||
int | sf, | ||
int | ef, | ||
int | w1, | ||
int | w2 | ||
) |
Begin N-Gram based A* search on a word graph.
sf | Starting frame for N-best search. |
ef | Ending frame for N-best search, or -1 for last frame. |
w1 | First context word, or -1 for none. |
w2 | Second context word, or -1 for none. |
Definition at line 1712 of file ps_lattice.c.
References ps_lattice_s::end, ps_latnode_s::exits, ps_astar_s::latpath_alloc, ps_lattice_s::n_frames, ps_latnode_s::next, ps_lattice_s::nodes, ps_latnode_s::rem_score, ps_latnode_s::sf, and WORST_SCORE.
void ps_lattice_delete_unreachable | ( | ps_lattice_t * | dag | ) |
Remove nodes marked as unreachable.
Definition at line 174 of file ps_lattice.c.
References ps_latnode_s::next, ps_lattice_s::nodes, and ps_latnode_s::reachable.
void ps_lattice_delq | ( | ps_lattice_t * | dag | ) |
Clear and reset the traversal queue.
Definition at line 1083 of file ps_lattice.c.
References ps_lattice_popq().
Referenced by ps_lattice_reverse_edges(), ps_lattice_reverse_next(), ps_lattice_traverse_edges(), and ps_lattice_traverse_next().
char const * ps_lattice_hyp | ( | ps_lattice_t * | dag, |
ps_latlink_t * | link | ||
) |
Get hypothesis string after bestpath search.
Definition at line 830 of file ps_lattice.c.
References ps_latnode_s::basewid, ps_lattice_s::dict, dict_real_word(), and ps_latlink_s::to.
ps_lattice_t * ps_lattice_init_search | ( | ps_search_t * | search, |
int | n_frame | ||
) |
Construct an empty word graph with reference to a search structure.
Definition at line 639 of file ps_lattice.c.
References ps_search_s::acmod, ps_search_s::config, ps_search_s::dict, ps_lattice_s::dict, dict_retain(), ps_lattice_s::frate, acmod_s::lmath, ps_lattice_s::lmath, ps_lattice_s::search, and ps_lattice_s::silence.
void ps_lattice_penalize_fillers | ( | ps_lattice_t * | dag, |
int32 | silpen, | ||
int32 | fillpen | ||
) |
Insert penalty for fillers.
Definition at line 106 of file ps_lattice.c.
References ps_latlink_s::ascr, ps_latnode_s::basewid, ps_lattice_s::dict, dict_filler_word(), ps_lattice_s::end, ps_latnode_s::entries, ps_latnode_s::next, ps_lattice_s::nodes, ps_lattice_s::silence, and ps_lattice_s::start.
ps_latlink_t * ps_lattice_popq | ( | ps_lattice_t * | dag | ) |
Remove an edge from the traversal queue.
Definition at line 1066 of file ps_lattice.c.
References ps_lattice_s::latlink_list_alloc, ps_lattice_s::q_head, and ps_lattice_s::q_tail.
Referenced by ps_lattice_delq(), ps_lattice_reverse_next(), and ps_lattice_traverse_next().
void ps_lattice_pushq | ( | ps_lattice_t * | dag, |
ps_latlink_t * | link | ||
) |
Add an edge to the traversal queue.
Definition at line 1054 of file ps_lattice.c.
References latlink_list_new(), ps_lattice_s::q_head, and ps_lattice_s::q_tail.
Referenced by ps_lattice_reverse_edges(), ps_lattice_reverse_next(), ps_lattice_traverse_edges(), and ps_lattice_traverse_next().
ps_seg_t * ps_lattice_seg_iter | ( | ps_lattice_t * | dag, |
ps_latlink_t * | link, | ||
float32 | lwf | ||
) |
Get hypothesis segmentation iterator after bestpath search.
Definition at line 1006 of file ps_lattice.c.
References dag_seg_s::base, and ps_seg_s::vt.