| 1 |
Configuration parameters |
| 2 |
======================== |
| 3 |
|
| 4 |
These are the parameters currently recognized by |
| 5 |
`pocketsphinx.Config` and `pocketsphinx.Decoder` along with their |
| 6 |
default values. |
| 7 |
|
| 8 |
.. method:: Config(*args, **kwargs) |
| 9 |
|
| 10 |
Create a PocketSphinx configuration from keyword arguments |
| 11 |
described below. For example:: |
| 12 |
|
| 13 |
config = Config(hmm="path/to/things", dict="my.dict") |
| 14 |
|
| 15 |
The same keyword arguments can also be passed directly to the |
| 16 |
constructor for `pocketsphinx.Decoder`. |
| 17 |
|
| 18 |
Many parameters have default values. Also, when constructing a |
| 19 |
`Config` directly (as opposed to parsing JSON), `hmm`, `lm`, and |
| 20 |
`dict` are set to the default models (some kind of US English |
| 21 |
models of unknown origin + CMUDict). You can prevent this by |
| 22 |
passing `None` for any of these parameters, e.g.:: |
| 23 |
|
| 24 |
config = Config(lm=None) # Do not load a language model |
| 25 |
|
| 26 |
Decoder initialization **will fail** if more than one of `lm`, |
| 27 |
`jsgf`, `fsg`, `keyphrase`, `kws`, `allphone`, or `lmctl` are set |
| 28 |
in the configuration. To make life easier, and because there is no |
| 29 |
possible case in which you would do this intentionally, if you |
| 30 |
initialize a `Decoder` or `Config` with any of these (and not |
| 31 |
`lm`), the default `lm` value will be removed. This is not the |
| 32 |
case if you decide to set one of them in an existing `Config`, so |
| 33 |
in that case you must make sure to set `lm` to `None`:: |
| 34 |
|
| 35 |
config["jsgf"] = "spam_eggs_and_spam.gram" |
| 36 |
config["lm"] = None |
| 37 |
|
| 38 |
|
| 39 |
:keyword str hmm: Directory containing acoustic model files. |
| 40 |
:keyword bool logspec: Write out logspectral files instead of cepstra, defaults to ``False`` |
| 41 |
:keyword bool smoothspec: Write out cepstral-smoothed logspectral files, defaults to ``False`` |
| 42 |
:keyword str transform: Which type of transform to use to calculate cepstra (legacy, dct, or htk), defaults to ``legacy`` |
| 43 |
:keyword float alpha: Preemphasis parameter, defaults to ``0.97`` |
| 44 |
:keyword int samprate: Sampling rate, defaults to ``16000`` |
| 45 |
:keyword int frate: Frame rate, defaults to ``100`` |
| 46 |
:keyword float wlen: Hamming window length, defaults to ``0.025625`` |
| 47 |
:keyword int nfft: Size of FFT, or 0 to set automatically (recommended), defaults to ``0`` |
| 48 |
:keyword int nfilt: Number of filter banks, defaults to ``40`` |
| 49 |
:keyword float lowerf: Lower edge of filters, defaults to ``133.33334`` |
| 50 |
:keyword float upperf: Upper edge of filters, defaults to ``6855.4976`` |
| 51 |
:keyword bool unit_area: Normalize mel filters to unit area, defaults to ``True`` |
| 52 |
:keyword bool round_filters: Round mel filter frequencies to DFT points, defaults to ``True`` |
| 53 |
:keyword int ncep: Number of cep coefficients, defaults to ``13`` |
| 54 |
:keyword bool doublebw: Use double bandwidth filters (same center freq), defaults to ``False`` |
| 55 |
:keyword int lifter: Length of sin-curve for liftering, or 0 for no liftering., defaults to ``0`` |
| 56 |
:keyword str input_endian: Endianness of input data, big or little, ignored if NIST or MS Wav, defaults to ``little`` |
| 57 |
:keyword str warp_type: Warping function type (or shape), defaults to ``inverse_linear`` |
| 58 |
:keyword str warp_params: Parameters defining the warping function |
| 59 |
:keyword bool dither: Add 1/2-bit noise, defaults to ``False`` |
| 60 |
:keyword int seed: Seed for random number generator; if less than zero, pick our own, defaults to ``-1`` |
| 61 |
:keyword bool remove_dc: Remove DC offset from each frame, defaults to ``False`` |
| 62 |
:keyword bool remove_noise: Remove noise using spectral subtraction, defaults to ``False`` |
| 63 |
:keyword bool verbose: Show input filenames, defaults to ``False`` |
| 64 |
:keyword str feat: Feature stream type, depends on the acoustic model, defaults to ``1s_c_d_dd`` |
| 65 |
:keyword int ceplen: Number of components in the input feature vector, defaults to ``13`` |
| 66 |
:keyword str cmn: Cepstral mean normalization scheme ('live', 'batch', or 'none'), defaults to ``live`` |
| 67 |
:keyword str cmninit: Initial values (comma-separated) for cepstral mean when 'live' is used, defaults to ``40,3,-1`` |
| 68 |
:keyword bool varnorm: Variance normalize each utterance (only if CMN == current), defaults to ``False`` |
| 69 |
:keyword str agc: Automatic gain control for c0 ('max', 'emax', 'noise', or 'none'), defaults to ``none`` |
| 70 |
:keyword float agcthresh: Initial threshold for automatic gain control, defaults to ``2.0`` |
| 71 |
:keyword str lda: File containing transformation matrix to be applied to features (single-stream features only) |
| 72 |
:keyword int ldadim: Dimensionality of output of feature transformation (0 to use entire matrix), defaults to ``0`` |
| 73 |
:keyword str svspec: Subvector specification (e.g., 24,0-11/25,12-23/26-38 or 0-12/13-25/26-38) |
| 74 |
:keyword str featparams: File containing feature extraction parameters. |
| 75 |
:keyword str mdef: Model definition input file |
| 76 |
:keyword str senmgau: Senone to codebook mapping input file (usually not needed) |
| 77 |
:keyword str tmat: HMM state transition matrix input file |
| 78 |
:keyword float tmatfloor: HMM state transition probability floor (applied to -tmat file), defaults to ``0.0001`` |
| 79 |
:keyword str mean: Mixture gaussian means input file |
| 80 |
:keyword str var: Mixture gaussian variances input file |
| 81 |
:keyword float varfloor: Mixture gaussian variance floor (applied to data from -var file), defaults to ``0.0001`` |
| 82 |
:keyword str mixw: Senone mixture weights input file (uncompressed) |
| 83 |
:keyword float mixwfloor: Senone mixture weights floor (applied to data from -mixw file), defaults to ``1e-07`` |
| 84 |
:keyword int aw: Inverse weight applied to acoustic scores., defaults to ``1`` |
| 85 |
:keyword str sendump: Senone dump (compressed mixture weights) input file |
| 86 |
:keyword str mllr: MLLR transformation to apply to means and variances |
| 87 |
:keyword bool mmap: Use memory-mapped I/O (if possible) for model files, defaults to ``True`` |
| 88 |
:keyword int ds: Frame GMM computation downsampling ratio, defaults to ``1`` |
| 89 |
:keyword int topn: Maximum number of top Gaussians to use in scoring., defaults to ``4`` |
| 90 |
:keyword str topn_beam: Beam width used to determine top-N Gaussians (or a list, per-feature), defaults to ``0`` |
| 91 |
:keyword float logbase: Base in which all log-likelihoods calculated, defaults to ``1.0001`` |
| 92 |
:keyword float beam: Beam width applied to every frame in Viterbi search (smaller values mean wider beam), defaults to ``1e-48`` |
| 93 |
:keyword float wbeam: Beam width applied to word exits, defaults to ``7e-29`` |
| 94 |
:keyword float pbeam: Beam width applied to phone transitions, defaults to ``1e-48`` |
| 95 |
:keyword float lpbeam: Beam width applied to last phone in words, defaults to ``1e-40`` |
| 96 |
:keyword float lponlybeam: Beam width applied to last phone in single-phone words, defaults to ``7e-29`` |
| 97 |
:keyword float fwdflatbeam: Beam width applied to every frame in second-pass flat search, defaults to ``1e-64`` |
| 98 |
:keyword float fwdflatwbeam: Beam width applied to word exits in second-pass flat search, defaults to ``7e-29`` |
| 99 |
:keyword int pl_window: Phoneme lookahead window size, in frames, defaults to ``5`` |
| 100 |
:keyword float pl_beam: Beam width applied to phone loop search for lookahead, defaults to ``1e-10`` |
| 101 |
:keyword float pl_pbeam: Beam width applied to phone loop transitions for lookahead, defaults to ``1e-10`` |
| 102 |
:keyword float pl_pip: Phone insertion penalty for phone loop, defaults to ``1.0`` |
| 103 |
:keyword float pl_weight: Weight for phoneme lookahead penalties, defaults to ``3.0`` |
| 104 |
:keyword bool compallsen: Compute all senone scores in every frame (can be faster when there are many senones), defaults to ``False`` |
| 105 |
:keyword bool fwdtree: Run forward lexicon-tree search (1st pass), defaults to ``True`` |
| 106 |
:keyword bool fwdflat: Run forward flat-lexicon search over word lattice (2nd pass), defaults to ``True`` |
| 107 |
:keyword bool bestpath: Run bestpath (Dijkstra) search over word lattice (3rd pass), defaults to ``True`` |
| 108 |
:keyword bool backtrace: Print results and backtraces to log., defaults to ``False`` |
| 109 |
:keyword int latsize: Initial backpointer table size, defaults to ``5000`` |
| 110 |
:keyword int maxwpf: Maximum number of distinct word exits at each frame (or -1 for no pruning), defaults to ``-1`` |
| 111 |
:keyword int maxhmmpf: Maximum number of active HMMs to maintain at each frame (or -1 for no pruning), defaults to ``30000`` |
| 112 |
:keyword int min_endfr: Nodes ignored in lattice construction if they persist for fewer than N frames, defaults to ``0`` |
| 113 |
:keyword int fwdflatefwid: Minimum number of end frames for a word to be searched in fwdflat search, defaults to ``4`` |
| 114 |
:keyword int fwdflatsfwin: Window of frames in lattice to search for successor words in fwdflat search , defaults to ``25`` |
| 115 |
:keyword str dict: Main pronunciation dictionary (lexicon) input file |
| 116 |
:keyword str fdict: Noise word pronunciation dictionary input file |
| 117 |
:keyword bool dictcase: Dictionary is case sensitive (NOTE: case insensitivity applies to ASCII characters only), defaults to ``False`` |
| 118 |
:keyword str allphone: Perform phoneme decoding with phonetic lm (given here) |
| 119 |
:keyword bool allphone_ci: Perform phoneme decoding with phonetic lm and context-independent units only, defaults to ``True`` |
| 120 |
:keyword str lm: Word trigram language model input file |
| 121 |
:keyword str lmctl: Specify a set of language model |
| 122 |
:keyword str lmname: Which language model in -lmctl to use by default |
| 123 |
:keyword float lw: Language model probability weight, defaults to ``6.5`` |
| 124 |
:keyword float fwdflatlw: Language model probability weight for flat lexicon (2nd pass) decoding, defaults to ``8.5`` |
| 125 |
:keyword float bestpathlw: Language model probability weight for bestpath search, defaults to ``9.5`` |
| 126 |
:keyword float ascale: Inverse of acoustic model scale for confidence score calculation, defaults to ``20.0`` |
| 127 |
:keyword float wip: Word insertion penalty, defaults to ``0.65`` |
| 128 |
:keyword float nwpen: New word transition penalty, defaults to ``1.0`` |
| 129 |
:keyword float pip: Phone insertion penalty, defaults to ``1.0`` |
| 130 |
:keyword float uw: Unigram weight, defaults to ``1.0`` |
| 131 |
:keyword float silprob: Silence word transition probability, defaults to ``0.005`` |
| 132 |
:keyword float fillprob: Filler word transition probability, defaults to ``1e-08`` |
| 133 |
:keyword str fsg: Sphinx format finite state grammar file |
| 134 |
:keyword str jsgf: JSGF grammar file |
| 135 |
:keyword str toprule: Start rule for JSGF (first public rule is default) |
| 136 |
:keyword bool fsgusealtpron: Add alternate pronunciations to FSG, defaults to ``True`` |
| 137 |
:keyword bool fsgusefiller: Insert filler words at each state., defaults to ``True`` |
| 138 |
:keyword str keyphrase: Keyphrase to spot |
| 139 |
:keyword str kws: A file with keyphrases to spot, one per line |
| 140 |
:keyword float kws_plp: Phone loop probability for keyphrase spotting, defaults to ``0.1`` |
| 141 |
:keyword int kws_delay: Delay to wait for best detection score, defaults to ``10`` |
| 142 |
:keyword float kws_threshold: Threshold for p(hyp)/p(alternatives) ratio, defaults to ``1e-30`` |
| 143 |
:keyword str logfn: File to write log messages in |
| 144 |
:keyword str loglevel: Minimum level of log messages (DEBUG, INFO, WARN, ERROR), defaults to ``WARN`` |
| 145 |
:keyword str mfclogdir: Directory to log feature files to |
| 146 |
:keyword str rawlogdir: Directory to log raw audio files to |
| 147 |
:keyword str senlogdir: Directory to log senone score files to |