|
PocketSphinx
0.6
|
Binary format model definition files, with support for heterogeneous topologies and variable-size N-phones. More...
#include <sphinxbase/mmio.h>#include <sphinxbase/cmd_ln.h>#include <pocketsphinx_export.h>#include "mdef.h"Go to the source code of this file.
Data Structures | |
| struct | mdef_entry_s |
| struct | cd_tree_s |
| struct | bin_mdef_s |
Macros | |
| #define | BIN_MDEF_FORMAT_VERSION 1 |
| #define | BIN_MDEF_NATIVE_ENDIAN 0x46444d42 /* 'BMDF' in little-endian order */ |
| #define | BIN_MDEF_OTHER_ENDIAN 0x424d4446 /* 'BMDF' in big-endian order */ |
| #define | ATTRIBUTE_PACKED |
| #define | BAD_SSID 0xffff |
| Invalid senone sequence ID (limited to 16 bits for PocketSphinx). | |
| #define | BAD_SENID 0xffff |
| Invalid senone ID (limited to 16 bits for PocketSphinx). | |
| #define | bin_mdef_is_fillerphone(m, p) |
| #define | bin_mdef_is_ciphone(m, p) ((p) < (m)->n_ciphone) |
| #define | bin_mdef_n_ciphone(m) ((m)->n_ciphone) |
| #define | bin_mdef_n_phone(m) ((m)->n_phone) |
| #define | bin_mdef_n_sseq(m) ((m)->n_sseq) |
| #define | bin_mdef_n_emit_state(m) ((m)->n_emit_state) |
| #define | bin_mdef_n_emit_state_phone(m, p) |
| #define | bin_mdef_n_sen(m) ((m)->n_sen) |
| #define | bin_mdef_n_tmat(m) ((m)->n_tmat) |
| #define | bin_mdef_pid2ssid(m, p) ((m)->phone[p].ssid) |
| #define | bin_mdef_pid2tmatid(m, p) ((m)->phone[p].tmat) |
| #define | bin_mdef_silphone(m) ((m)->sil) |
| #define | bin_mdef_sen2cimap(m, s) ((m)->sen2cimap[s]) |
| #define | bin_mdef_sseq2sen(m, ss, pos) ((m)->sseq[ss][pos]) |
| #define | bin_mdef_pid2ci(m, p) |
Typedefs | |
| typedef struct mdef_entry_s | mdef_entry_t |
| Phone entry (on-disk, 12 bytes) | |
| typedef struct cd_tree_s | cd_tree_t |
| Node in CD phone tree (on-disk, 8 bytes). | |
| typedef struct bin_mdef_s | bin_mdef_t |
| Model definition structure (in-memory). | |
Functions | |
| POCKETSPHINX_EXPORT bin_mdef_t * | bin_mdef_read (cmd_ln_t *config, const char *filename) |
| Read a binary mdef from a file. | |
| POCKETSPHINX_EXPORT bin_mdef_t * | bin_mdef_read_text (cmd_ln_t *config, const char *filename) |
| Read a text mdef from a file (creating an in-memory binary mdef). | |
| POCKETSPHINX_EXPORT int | bin_mdef_write (bin_mdef_t *m, const char *filename) |
| Write a binary mdef to a file. | |
| POCKETSPHINX_EXPORT int | bin_mdef_write_text (bin_mdef_t *m, const char *filename) |
| Write a binary mdef to a text file. | |
| bin_mdef_t * | bin_mdef_retain (bin_mdef_t *m) |
| Retain a pointer to a bin_mdef_t. | |
| int | bin_mdef_free (bin_mdef_t *m) |
| Release a pointer to a binary mdef. | |
| int | bin_mdef_ciphone_id (bin_mdef_t *m, const char *ciphone) |
| Context-independent phone lookup. More... | |
| int | bin_mdef_ciphone_id_nocase (bin_mdef_t *m, const char *ciphone) |
| Case-insensitive context-independent phone lookup. More... | |
| const char * | bin_mdef_ciphone_str (bin_mdef_t *m, int32 ci) |
| In: ciphone id for which name wanted. More... | |
| int | bin_mdef_phone_id (bin_mdef_t *m, int32 b, int32 l, int32 r, int32 pos) |
| In: Word position. More... | |
| int | bin_mdef_phone_id_nearest (bin_mdef_t *m, int32 b, int32 l, int32 r, int32 pos) |
| int | bin_mdef_phone_str (bin_mdef_t *m, int pid, char *buf) |
| Create a phone string for the given phone (base or triphone) id in the given buf. More... | |
Variables | |
| struct mdef_entry_s | ATTRIBUTE_PACKED |
Binary format model definition files, with support for heterogeneous topologies and variable-size N-phones.
Definition in file bin_mdef.h.
| #define bin_mdef_is_fillerphone | ( | m, | |
| p | |||
| ) |
Definition at line 148 of file bin_mdef.h.
| #define bin_mdef_n_emit_state_phone | ( | m, | |
| p | |||
| ) |
Definition at line 156 of file bin_mdef.h.
| #define bin_mdef_pid2ci | ( | m, | |
| p | |||
| ) |
Definition at line 165 of file bin_mdef.h.
| int bin_mdef_ciphone_id | ( | bin_mdef_t * | m, |
| const char * | ciphone | ||
| ) |
Context-independent phone lookup.
| m | In: Model structure being queried |
Definition at line 691 of file bin_mdef.c.
References bin_mdef_s::ciname, and bin_mdef_s::n_ciphone.
Referenced by bin_mdef_read(), and ps_add_word().
| int bin_mdef_ciphone_id_nocase | ( | bin_mdef_t * | m, |
| const char * | ciphone | ||
| ) |
Case-insensitive context-independent phone lookup.
| m | In: Model structure being queried |
Definition at line 714 of file bin_mdef.c.
References bin_mdef_s::ciname, and bin_mdef_s::n_ciphone.
| const char* bin_mdef_ciphone_str | ( | bin_mdef_t * | m, |
| int32 | ci | ||
| ) |
In: ciphone id for which name wanted.
| m | In: Model structure being queried |
Definition at line 737 of file bin_mdef.c.
References bin_mdef_s::ciname.
Referenced by bin_mdef_phone_str(), dict2pid_add_word(), dict2pid_build(), dict2pid_dump(), and dict_ciphone_str().
| int bin_mdef_phone_id | ( | bin_mdef_t * | m, |
| int32 | b, | ||
| int32 | l, | ||
| int32 | r, | ||
| int32 | pos | ||
| ) |
In: Word position.
| m | In: Model structure being queried |
| b | In: base ciphone id |
| l | In: left context ciphone id |
| r | In: right context ciphone id |
Definition at line 745 of file bin_mdef.c.
References bin_mdef_s::cd_tree, mdef_entry_s::ci, bin_mdef_s::ciname, cd_tree_s::ctx, cd_tree_s::down, cd_tree_s::n_down, N_WORD_POSN, bin_mdef_s::phone, cd_tree_s::pid, and bin_mdef_s::sil.
| int bin_mdef_phone_str | ( | bin_mdef_t * | m, |
| int | pid, | ||
| char * | buf | ||
| ) |
Create a phone string for the given phone (base or triphone) id in the given buf.
| m | In: Model structure being queried |
| pid | In: phone id being queried |
Definition at line 868 of file bin_mdef.c.
References bin_mdef_ciphone_str(), bin_mdef_s::phone, and WPOS_NAME.