void fsg_lextree_dump(fsg_lextree_t * lextree, FILE * fp) { int32 s; for (s = 0; s < fsg_model_n_state(lextree->fsg); s++) { fprintf(fp, "State %5d root %p\n", s, lextree->root[s]); fsg_psubtree_dump(lextree, lextree->root[s], fp); } fflush(fp); }
void fsg_psubtree_dump(fsg_lextree_t *tree, fsg_pnode_t *root, FILE * fp) { fsg_pnode_t *succ; if (root == NULL) return; if (root->ppos == 0) { while(root->sibling && root->sibling->next.succ == root->next.succ) { fsg_psubtree_dump_node(tree, root, fp); root = root->sibling; } fflush(fp); } fsg_psubtree_dump_node(tree, root, fp); if (root->leaf) { if (root->ppos == 0 && root->sibling) { // For single-phone words fsg_psubtree_dump(tree, root->sibling,fp); } return; } succ = root->next.succ; while(succ) { fsg_psubtree_dump(tree, succ,fp); succ = succ->sibling; } if (root->ppos == 0) { fsg_psubtree_dump(tree, root->sibling,fp); fflush(fp); } return; }