Commit f8b9515a authored by Daniel Povey's avatar Daniel Povey

Merge pull request #44 from vdp/po-to-opts

Cosmetic variable name change: OptionsItf po -> OptionsItf opts
parents 5c01929a 28d28b07
......@@ -38,13 +38,13 @@ struct AlignConfig {
AlignConfig(): beam(200.0), retry_beam(0.0), careful(false) { }
void Register(OptionsItf *po) {
po->Register("beam", &beam, "Decoding beam used in alignment");
po->Register("retry-beam", &retry_beam,
"Decoding beam for second try at alignment");
po->Register("careful", &careful,
"If true, do 'careful' alignment, which is better at detecting "
"alignment failure (involves loop to start of decoding graph).");
void Register(OptionsItf *opts) {
opts->Register("beam", &beam, "Decoding beam used in alignment");
opts->Register("retry-beam", &retry_beam,
"Decoding beam for second try at alignment");
opts->Register("careful", &careful,
"If true, do 'careful' alignment, which is better at detecting "
"alignment failure (involves loop to start of decoding graph).");
}
};
......
......@@ -42,18 +42,18 @@ struct FasterDecoderOptions {
// alignment, use small default.
beam_delta(0.5),
hash_ratio(2.0) { }
void Register(OptionsItf *po, bool full) { /// if "full", use obscure
void Register(OptionsItf *opts, bool full) { /// if "full", use obscure
/// options too.
/// Depends on program.
po->Register("beam", &beam, "Decoder beam");
po->Register("max-active", &max_active, "Decoder max active states.");
po->Register("min-active", &min_active,
"Decoder min active states (don't prune if #active less than this).");
opts->Register("beam", &beam, "Decoder beam");
opts->Register("max-active", &max_active, "Decoder max active states.");
opts->Register("min-active", &min_active,
"Decoder min active states (don't prune if #active less than this).");
if (full) {
po->Register("beam-delta", &beam_delta,
"Increment used in decoder [obscure setting]");
po->Register("hash-ratio", &hash_ratio,
"Setting used in decoder to control hash behavior");
opts->Register("beam-delta", &beam_delta,
"Increment used in decoder [obscure setting]");
opts->Register("hash-ratio", &hash_ratio,
"Setting used in decoder to control hash behavior");
}
}
};
......
......@@ -64,22 +64,22 @@ struct LatticeFasterDecoderConfig {
beam_delta(0.5),
hash_ratio(2.0),
prune_scale(0.1) { }
void Register(OptionsItf *po) {
det_opts.Register(po);
po->Register("beam", &beam, "Decoding beam.");
po->Register("max-active", &max_active, "Decoder max active states.");
po->Register("min-active", &min_active, "Decoder minimum #active states.");
po->Register("lattice-beam", &lattice_beam, "Lattice generation beam");
po->Register("prune-interval", &prune_interval, "Interval (in frames) at "
"which to prune tokens");
po->Register("determinize-lattice", &determinize_lattice, "If true, "
"determinize the lattice (in a special sense, keeping only "
"best pdf-sequence for each word-sequence).");
po->Register("beam-delta", &beam_delta, "Increment used in decoding-- this "
"parameter is obscure and relates to a speedup in the way the "
"max-active constraint is applied. Larger is more accurate.");
po->Register("hash-ratio", &hash_ratio, "Setting used in decoder to control"
" hash behavior");
void Register(OptionsItf *opts) {
det_opts.Register(opts);
opts->Register("beam", &beam, "Decoding beam.");
opts->Register("max-active", &max_active, "Decoder max active states.");
opts->Register("min-active", &min_active, "Decoder minimum #active states.");
opts->Register("lattice-beam", &lattice_beam, "Lattice generation beam");
opts->Register("prune-interval", &prune_interval, "Interval (in frames) at "
"which to prune tokens");
opts->Register("determinize-lattice", &determinize_lattice, "If true, "
"determinize the lattice (in a special sense, keeping only "
"best pdf-sequence for each word-sequence).");
opts->Register("beam-delta", &beam_delta, "Increment used in decoding-- this "
"parameter is obscure and relates to a speedup in the way the "
"max-active constraint is applied. Larger is more accurate.");
opts->Register("hash-ratio", &hash_ratio, "Setting used in decoder to control"
" hash behavior");
}
void Check() const {
KALDI_ASSERT(beam > 0.0 && max_active > 1 && lattice_beam > 0.0
......
......@@ -53,15 +53,15 @@ struct LatticeSimpleDecoderConfig {
determinize_lattice(true),
beam_ratio(0.9),
prune_scale(0.1) { }
void Register(OptionsItf *po) {
det_opts.Register(po);
po->Register("beam", &beam, "Decoding beam.");
po->Register("lattice-beam", &lattice_beam, "Lattice generation beam");
po->Register("prune-interval", &prune_interval, "Interval (in frames) at "
"which to prune tokens");
po->Register("determinize-lattice", &determinize_lattice, "If true, "
"determinize the lattice (in a special sense, keeping only "
"best pdf-sequence for each word-sequence).");
void Register(OptionsItf *opts) {
det_opts.Register(opts);
opts->Register("beam", &beam, "Decoding beam.");
opts->Register("lattice-beam", &lattice_beam, "Lattice generation beam");
opts->Register("prune-interval", &prune_interval, "Interval (in frames) at "
"which to prune tokens");
opts->Register("determinize-lattice", &determinize_lattice, "If true, "
"determinize the lattice (in a special sense, keeping only "
"best pdf-sequence for each word-sequence).");
}
void Check() const {
KALDI_ASSERT(beam > 0.0 && lattice_beam > 0.0 && prune_interval > 0);
......
......@@ -54,23 +54,23 @@ struct LatticeTrackingDecoderConfig {
hash_ratio(2.0),
extra_beam(4.0),
max_beam(40.0) { }
void Register(OptionsItf *po) {
det_opts.Register(po);
po->Register("beam", &beam, "Decoding beam.");
po->Register("max-active", &max_active, "Decoder max active states.");
po->Register("lattice-beam", &lattice_beam, "Lattice generation beam");
po->Register("prune-interval", &prune_interval, "Interval (in frames) at "
"which to prune tokens");
po->Register("determinize-lattice", &determinize_lattice, "If true, "
"determinize the lattice (in a special sense, keeping only "
"best pdf-sequence for each word-sequence).");
po->Register("beam-delta", &beam_delta, "Increment used in decoding");
po->Register("hash-ratio", &hash_ratio, "Setting used in decoder to control"
" hash behavior");
po->Register("extra-beam", &extra_beam, "Increment used in decoding (added "
"to worst tracked token from first pass)");
po->Register("max-beam", &max_beam, "Maximum beam (in case tracked tokens "
"go too far from beam)");
void Register(OptionsItf *opts) {
det_opts.Register(opts);
opts->Register("beam", &beam, "Decoding beam.");
opts->Register("max-active", &max_active, "Decoder max active states.");
opts->Register("lattice-beam", &lattice_beam, "Lattice generation beam");
opts->Register("prune-interval", &prune_interval, "Interval (in frames) at "
"which to prune tokens");
opts->Register("determinize-lattice", &determinize_lattice, "If true, "
"determinize the lattice (in a special sense, keeping only "
"best pdf-sequence for each word-sequence).");
opts->Register("beam-delta", &beam_delta, "Increment used in decoding");
opts->Register("hash-ratio", &hash_ratio, "Setting used in decoder to control"
" hash behavior");
opts->Register("extra-beam", &extra_beam, "Increment used in decoding (added "
"to worst tracked token from first pass)");
opts->Register("max-beam", &max_beam, "Maximum beam (in case tracked tokens "
"go too far from beam)");
}
void Check() const {
......
......@@ -41,17 +41,17 @@ struct NBestDecoderOptions {
max_active(std::numeric_limits<int32>::max()),
n_best(1),
beam_delta(0.5), hash_ratio(2.0) { }
void Register(OptionsItf *po, bool full) { /// if "full", use obscure
void Register(OptionsItf *opts, bool full) { /// if "full", use obscure
/// options too.
/// Depends on program.
po->Register("beam", &beam, "Decoder beam");
po->Register("max-active", &max_active, "Decoder max active states.");
po->Register("n-best", &n_best, "Decoder number of best tokens.");
opts->Register("beam", &beam, "Decoder beam");
opts->Register("max-active", &max_active, "Decoder max active states.");
opts->Register("n-best", &n_best, "Decoder number of best tokens.");
if (full) {
po->Register("beam-delta", &beam_delta,
"Increment used in decoder [obscure setting]");
po->Register("hash-ratio", &hash_ratio,
"Setting used in decoder to control hash behavior");
opts->Register("beam-delta", &beam_delta,
"Increment used in decoder [obscure setting]");
opts->Register("hash-ratio", &hash_ratio,
"Setting used in decoder to control hash behavior");
}
}
};
......
......@@ -42,14 +42,14 @@ struct TrainingGraphCompilerOptions {
rm_eps(false),
reorder(b) { }
void Register(OptionsItf *po) {
po->Register("transition-scale", &transition_scale, "Scale of transition "
"probabilities (excluding self-loops)");
po->Register("self-loop-scale", &self_loop_scale, "Scale of self-loop vs. "
"non-self-loop probability mass ");
po->Register("reorder", &reorder, "Reorder transition ids for greater decoding efficiency.");
po->Register("rm-eps", &rm_eps, "Remove [most] epsilons before minimization (only applicable "
"if disambig symbols present)");
void Register(OptionsItf *opts) {
opts->Register("transition-scale", &transition_scale, "Scale of transition "
"probabilities (excluding self-loops)");
opts->Register("self-loop-scale", &self_loop_scale, "Scale of self-loop vs. "
"non-self-loop probability mass ");
opts->Register("reorder", &reorder, "Reorder transition ids for greater decoding efficiency.");
opts->Register("rm-eps", &rm_eps, "Remove [most] epsilons before minimization (only applicable "
"if disambig symbols present)");
}
};
......
......@@ -53,20 +53,20 @@ struct FbankOptions {
htk_compat(false),
use_log_fbank(true) {}
void Register(OptionsItf *po) {
frame_opts.Register(po);
mel_opts.Register(po);
po->Register("use-energy", &use_energy,
"Add an extra dimension with energy to the FBANK output.");
po->Register("energy-floor", &energy_floor,
"Floor on energy (absolute, not relative) in FBANK computation");
po->Register("raw-energy", &raw_energy,
"If true, compute energy before preemphasis and windowing");
po->Register("htk-compat", &htk_compat, "If true, put energy last. "
"Warning: not sufficient to get HTK compatible features (need "
"to change other parameters).");
po->Register("use-log-fbank", &use_log_fbank,
"If true, produce log-filterbank, else produce linear.");
void Register(OptionsItf *opts) {
frame_opts.Register(opts);
mel_opts.Register(opts);
opts->Register("use-energy", &use_energy,
"Add an extra dimension with energy to the FBANK output.");
opts->Register("energy-floor", &energy_floor,
"Floor on energy (absolute, not relative) in FBANK computation");
opts->Register("raw-energy", &raw_energy,
"If true, compute energy before preemphasis and windowing");
opts->Register("htk-compat", &htk_compat, "If true, put energy last. "
"Warning: not sufficient to get HTK compatible features (need "
"to change other parameters).");
opts->Register("use-log-fbank", &use_log_fbank,
"If true, produce log-filterbank, else produce linear.");
}
};
......
......@@ -52,20 +52,20 @@ struct MelBanksOptions {
: num_bins(num_bins), low_freq(20), high_freq(0), vtln_low(100),
vtln_high(-500), debug_mel(false), htk_mode(false) {}
void Register(OptionsItf *po) {
po->Register("num-mel-bins", &num_bins,
"Number of triangular mel-frequency bins");
po->Register("low-freq", &low_freq,
"Low cutoff frequency for mel bins");
po->Register("high-freq", &high_freq,
"High cutoff frequency for mel bins (if < 0, offset from Nyquist)");
po->Register("vtln-low", &vtln_low,
"Low inflection point in piecewise linear VTLN warping function");
po->Register("vtln-high", &vtln_high,
"High inflection point in piecewise linear VTLN warping function"
" (if negative, offset from high-mel-freq");
po->Register("debug-mel", &debug_mel,
"Print out debugging information for mel bin computation");
void Register(OptionsItf *opts) {
opts->Register("num-mel-bins", &num_bins,
"Number of triangular mel-frequency bins");
opts->Register("low-freq", &low_freq,
"Low cutoff frequency for mel bins");
opts->Register("high-freq", &high_freq,
"High cutoff frequency for mel bins (if < 0, offset from Nyquist)");
opts->Register("vtln-low", &vtln_low,
"Low inflection point in piecewise linear VTLN warping function");
opts->Register("vtln-high", &vtln_high,
"High inflection point in piecewise linear VTLN warping function"
" (if negative, offset from high-mel-freq");
opts->Register("debug-mel", &debug_mel,
"Print out debugging information for mel bin computation");
}
};
......@@ -95,26 +95,26 @@ struct FrameExtractionOptions {
round_to_power_of_two(true),
snip_edges(true){ }
void Register(OptionsItf *po) {
po->Register("sample-frequency", &samp_freq,
"Waveform data sample frequency (must match the waveform file, "
"if specified there)");
po->Register("frame-length", &frame_length_ms, "Frame length in milliseconds");
po->Register("frame-shift", &frame_shift_ms, "Frame shift in milliseconds");
po->Register("preemphasis-coefficient", &preemph_coeff,
"Coefficient for use in signal preemphasis");
po->Register("remove-dc-offset", &remove_dc_offset,
"Subtract mean from waveform on each frame");
po->Register("dither", &dither, "Dithering constant (0.0 means no dither)");
po->Register("window-type", &window_type, "Type of window "
"(\"hamming\"|\"hanning\"|\"povey\"|\"rectangular\")");
po->Register("round-to-power-of-two", &round_to_power_of_two,
"If true, round window size to power of two.");
po->Register("snip-edges", &snip_edges,
"If true, end effects will be handled by outputting only frames that "
"completely fit in the file, and the number of frames depends on the "
"frame-length. If false, the number of frames depends only on the "
"frame-shift, and we reflect the data at the ends.");
void Register(OptionsItf *opts) {
opts->Register("sample-frequency", &samp_freq,
"Waveform data sample frequency (must match the waveform file, "
"if specified there)");
opts->Register("frame-length", &frame_length_ms, "Frame length in milliseconds");
opts->Register("frame-shift", &frame_shift_ms, "Frame shift in milliseconds");
opts->Register("preemphasis-coefficient", &preemph_coeff,
"Coefficient for use in signal preemphasis");
opts->Register("remove-dc-offset", &remove_dc_offset,
"Subtract mean from waveform on each frame");
opts->Register("dither", &dither, "Dithering constant (0.0 means no dither)");
opts->Register("window-type", &window_type, "Type of window "
"(\"hamming\"|\"hanning\"|\"povey\"|\"rectangular\")");
opts->Register("round-to-power-of-two", &round_to_power_of_two,
"If true, round window size to power of two.");
opts->Register("snip-edges", &snip_edges,
"If true, end effects will be handled by outputting only frames that "
"completely fit in the file, and the number of frames depends on the "
"frame-length. If false, the number of frames depends only on the "
"frame-shift, and we reflect the data at the ends.");
}
int32 WindowShift() const {
return static_cast<int32>(samp_freq * 0.001 * frame_shift_ms);
......@@ -197,11 +197,11 @@ struct DeltaFeaturesOptions {
DeltaFeaturesOptions(int32 order = 2, int32 window = 2):
order(order), window(window) { }
void Register(OptionsItf *po) {
po->Register("delta-order", &order, "Order of delta computation");
po->Register("delta-window", &window,
"Parameter controlling window for delta computation (actual window"
" size for each delta order is 1 + 2*delta-window-size)");
void Register(OptionsItf *opts) {
opts->Register("delta-order", &order, "Order of delta computation");
opts->Register("delta-window", &window,
"Parameter controlling window for delta computation (actual window"
" size for each delta order is 1 + 2*delta-window-size)");
}
};
......@@ -233,11 +233,11 @@ struct ShiftedDeltaFeaturesOptions {
ShiftedDeltaFeaturesOptions():
window(1), num_blocks(7), block_shift(3) { }
void Register(OptionsItf *po) {
po->Register("delta-window", &window, "Size of delta advance and delay.");
po->Register("num-blocks", &num_blocks, "Number of delta blocks in advance"
" of each frame to be concatenated");
po->Register("block-shift", &block_shift, "Distance between each block");
void Register(OptionsItf *opts) {
opts->Register("delta-window", &window, "Size of delta advance and delay.");
opts->Register("num-blocks", &num_blocks, "Number of delta blocks in advance"
" of each frame to be concatenated");
opts->Register("block-shift", &block_shift, "Distance between each block");
}
};
......@@ -320,17 +320,17 @@ struct SlidingWindowCmnOptions {
normalize_variance(false),
center(false) { }
void Register(OptionsItf *po) {
po->Register("cmn-window", &cmn_window, "Window in frames for running "
"average CMN computation");
po->Register("min-cmn-window", &min_window, "Minimum CMN window "
"used at start of decoding (adds latency only at start). "
"Only applicable if center == false, ignored if center==true");
po->Register("norm-vars", &normalize_variance, "If true, normalize "
"variance to one."); // naming this as in apply-cmvn.cc
po->Register("center", &center, "If true, use a window centered on the "
"current frame (to the extent possible, modulo end effects). "
"If false, window is to the left.");
void Register(OptionsItf *opts) {
opts->Register("cmn-window", &cmn_window, "Window in frames for running "
"average CMN computation");
opts->Register("min-cmn-window", &min_window, "Minimum CMN window "
"used at start of decoding (adds latency only at start). "
"Only applicable if center == false, ignored if center==true");
opts->Register("norm-vars", &normalize_variance, "If true, normalize "
"variance to one."); // naming this as in apply-cmvn.cc
opts->Register("center", &center, "If true, use a window centered on the "
"current frame (to the extent possible, modulo end effects). "
"If false, window is to the left.");
}
void Check() const;
};
......
......@@ -57,23 +57,23 @@ struct MfccOptions {
cepstral_lifter(22.0),
htk_compat(false) {}
void Register(OptionsItf *po) {
frame_opts.Register(po);
mel_opts.Register(po);
po->Register("num-ceps", &num_ceps,
"Number of cepstra in MFCC computation (including C0)");
po->Register("use-energy", &use_energy,
"Use energy (not C0) in MFCC computation");
po->Register("energy-floor", &energy_floor,
"Floor on energy (absolute, not relative) in MFCC computation");
po->Register("raw-energy", &raw_energy,
"If true, compute energy before preemphasis and windowing");
po->Register("cepstral-lifter", &cepstral_lifter,
"Constant that controls scaling of MFCCs");
po->Register("htk-compat", &htk_compat,
"If true, put energy or C0 last and use a factor of sqrt(2) on "
"C0. Warning: not sufficient to get HTK compatible features "
"(need to change other parameters).");
void Register(OptionsItf *opts) {
frame_opts.Register(opts);
mel_opts.Register(opts);
opts->Register("num-ceps", &num_ceps,
"Number of cepstra in MFCC computation (including C0)");
opts->Register("use-energy", &use_energy,
"Use energy (not C0) in MFCC computation");
opts->Register("energy-floor", &energy_floor,
"Floor on energy (absolute, not relative) in MFCC computation");
opts->Register("raw-energy", &raw_energy,
"If true, compute energy before preemphasis and windowing");
opts->Register("cepstral-lifter", &cepstral_lifter,
"Constant that controls scaling of MFCCs");
opts->Register("htk-compat", &htk_compat,
"If true, put energy or C0 last and use a factor of sqrt(2) on "
"C0. Warning: not sufficient to get HTK compatible features "
"(need to change other parameters).");
}
};
......
......@@ -66,29 +66,29 @@ struct PlpOptions {
cepstral_scale(1.0),
htk_compat(false) {}
void Register(OptionsItf *po) {
frame_opts.Register(po);
mel_opts.Register(po);
po->Register("lpc-order", &lpc_order,
"Order of LPC analysis in PLP computation");
po->Register("num-ceps", &num_ceps,
"Number of cepstra in PLP computation (including C0)");
po->Register("use-energy", &use_energy,
"Use energy (not C0) for zeroth PLP feature");
po->Register("energy-floor", &energy_floor,
"Floor on energy (absolute, not relative) in PLP computation");
po->Register("raw-energy", &raw_energy,
"If true, compute energy before preemphasis and windowing");
po->Register("compress-factor", &compress_factor,
"Compression factor in PLP computation");
po->Register("cepstral-lifter", &cepstral_lifter,
"Constant that controls scaling of PLPs");
po->Register("cepstral-scale", &cepstral_scale,
"Scaling constant in PLP computation");
po->Register("htk-compat", &htk_compat,
"If true, put energy or C0 last and put factor of sqrt(2) on "
"C0. Warning: not sufficient to get HTK compatible features "
"(need to change other parameters).");
void Register(OptionsItf *opts) {
frame_opts.Register(opts);
mel_opts.Register(opts);
opts->Register("lpc-order", &lpc_order,
"Order of LPC analysis in PLP computation");
opts->Register("num-ceps", &num_ceps,
"Number of cepstra in PLP computation (including C0)");
opts->Register("use-energy", &use_energy,
"Use energy (not C0) for zeroth PLP feature");
opts->Register("energy-floor", &energy_floor,
"Floor on energy (absolute, not relative) in PLP computation");
opts->Register("raw-energy", &raw_energy,
"If true, compute energy before preemphasis and windowing");
opts->Register("compress-factor", &compress_factor,
"Compression factor in PLP computation");
opts->Register("cepstral-lifter", &cepstral_lifter,
"Constant that controls scaling of PLPs");
opts->Register("cepstral-scale", &cepstral_scale,
"Scaling constant in PLP computation");
opts->Register("htk-compat", &htk_compat,
"If true, put energy or C0 last and put factor of sqrt(2) on "
"C0. Warning: not sufficient to get HTK compatible features "
"(need to change other parameters).");
}
};
......
......@@ -44,12 +44,12 @@ struct SpectrogramOptions {
energy_floor(0.0), // not in log scale: a small value e.g. 1.0e-10
raw_energy(true) {}
void Register(OptionsItf *po) {
frame_opts.Register(po);
po->Register("energy-floor", &energy_floor,
"Floor on energy (absolute, not relative) in Spectrogram computation");
po->Register("raw-energy", &raw_energy,
"If true, compute energy before preemphasis and windowing");
void Register(OptionsItf *opts) {
frame_opts.Register(opts);
opts->Register("energy-floor", &energy_floor,
"Floor on energy (absolute, not relative) in Spectrogram computation");
opts->Register("raw-energy", &raw_energy,
"If true, compute energy before preemphasis and windowing");
}
};
......
This diff is collapsed.
......@@ -271,30 +271,30 @@ struct MultiSinusoidDetectorConfig {
max_freq(1800.0), subsample_freq(4000),
subsample_filter_cutoff(1900.0), subsample_filter_zeros(5) {}
void Register(OptionsItf *po) {
po->Register("frame-length", &frame_length_ms,
"Frame length in milliseconds");
po->Register("frame-shift", &frame_shift_ms,
"Frame shift in milliseconds");
po->Register("two-freq-min-energy", &two_freq_min_energy,
"For detecting two-frequency tones, minimum energy that "
"the quieter frequency must have (relative to total "
"enegy of frame)");
po->Register("two-freq-min-total-energy", &two_freq_min_total_energy,
"For detecting two-frequency tones, minimum energy that "
"the two frequencies together must have (relative to total "
"energy of frame)");
po->Register("one-freq-min-energy", &one_freq_min_energy, "For detecting "
"single-frequency tones, minimum energy that the frequency "
"must have relative to total energy of frame");
po->Register("min-freq", &min_freq, "Minimum frequency of sinusoid that "
"will be detected");
po->Register("max-freq", &max_freq, "Maximum frequency of sinusoid that "
"will be detected");
po->Register("subsample-freq", &subsample_freq, "Frequency at which "
"we subsample the signal");
po->Register("subsample-filter-cutoff", &subsample_filter_cutoff, "Filter "
"cut-off frequency used in subsampling");
void Register(OptionsItf *opts) {
opts->Register("frame-length", &frame_length_ms,
"Frame length in milliseconds");
opts->Register("frame-shift", &frame_shift_ms,
"Frame shift in milliseconds");
opts->Register("two-freq-min-energy", &two_freq_min_energy,
"For detecting two-frequency tones, minimum energy that "
"the quieter frequency must have (relative to total "
"enegy of frame)");
opts->Register("two-freq-min-total-energy", &two_freq_min_total_energy,
"For detecting two-frequency tones, minimum energy that "
"the two frequencies together must have (relative to total "
"energy of frame)");
opts->Register("one-freq-min-energy", &one_freq_min_energy, "For detecting "
"single-frequency tones, minimum energy that the frequency "
"must have relative to total energy of frame");
opts->Register("min-freq", &min_freq, "Minimum frequency of sinusoid that "
"will be detected");
opts->Register("max-freq", &max_freq, "Maximum frequency of sinusoid that "
"will be detected");
opts->Register("subsample-freq", &subsample_freq, "Frequency at which "
"we subsample the signal");
opts->Register("subsample-filter-cutoff", &subsample_filter_cutoff, "Filter "
"cut-off frequency used in subsampling");
}
void Check() const {
KALDI_ASSERT(frame_length_ms > 0 && frame_length_ms >= frame_shift_ms &&
......
......@@ -35,19 +35,19 @@ struct PitchInterpolatorOptions {
interpolator_factor(1.0e-05),
max_voicing_prob(0.9),
max_pitch_change_per_frame(10.0) { }
void Register(OptionsItf *po) {
po->Register("pitch-interval", &pitch_interval, "Frequency interval in Hz, used "
"for the pitch interpolation and smoothing algorithm.");
po->Register("interpolator-factor", &interpolator_factor, "Factor affecting the "
"interpolation algorithm; setting it closer to zero will cause "
"it to follow the measured pitch more faithfully but less "
"smoothly");
po->Register("max-voicing-prob", &max_voicing_prob, "Probability of voicing the "
"algorithm uses as the observed p(voicing) approaches 1; having "
"value <1 allows it to interpolate even if p(voicing) = 1");
po->Register("max-pitch-change-per-frame", &max_pitch_change_per_frame,
"This value should be set large enough to no longer affect the "
"results, but the larger it is the slower the algorithm will be.");
void Register(OptionsItf *opts) {
opts->Register("pitch-interval", &pitch_interval, "Frequency interval in Hz, used "
"for the pitch interpolation and smoothing algorithm.");
opts->Register("interpolator-factor", &interpolator_factor, "Factor affecting the "
"interpolation algorithm; setting it closer to zero will cause "
"it to follow the measured pitch more faithfully but less "
"smoothly");
opts->Register("max-voicing-prob", &max_voicing_prob, "Probability of voicing the "
"algorithm uses as the observed p(voicing) approaches 1; having "
"value <1 allows it to interpolate even if p(voicing) = 1");
opts->Register("max-pitch-change-per-frame", &max_pitch_change_per_frame,
"This value should be set large enough to no longer affect the "
"results, but the larger it is the slower the algorithm will be.");
}
void Check() const {
KALDI_ASSERT(pitch_interval > 0.0 && pitch_interval < 20.0 &&
......@@ -301,26 +301,26 @@ int main(int argc, char *argv[]) {
// construct all the global objects
ParseOptions po(usage);
ParseOptions opts(usage);
bool linear_interpolation = false;
PitchInterpolatorOptions interpolate_opts;
po.Register("linear-interpolation",
opts.Register("linear-interpolation",
&linear_interpolation, "If true, just do simple linear "
"interpolation across gaps (else, model-based)");
interpolate_opts.Register(&po);
interpolate_opts.Register(&opts);
// parse options (+filling the registered variables)
po.Read(argc, argv);
opts.Read(argc, argv);
if (po.NumArgs() != 2) {
po.PrintUsage();
if (opts.NumArgs() != 2) {
opts.PrintUsage();
exit(1);
}
std::string input_rspecifier = po.GetArg(1);
std::string output_wspecifier = po.GetArg(2);
std::string input_rspecifier = opts.GetArg(1);
std::string output_wspecifier = opts.GetArg(2);
SequentialBaseFloatMatrixReader reader(input_rspecifier);
BaseFloatMatrixWriter kaldi_writer; // typedef to TableWriter<something>.
......
......@@ -173,22 +173,22 @@ struct UbmClusteringOptions {
: ubm_num_gauss(ncomp), reduce_state_factor(red),
intermediate_num_gauss(interm_gauss), cluster_varfloor(vfloor),
max_am_gauss(max_am_gauss) {}
void Register(OptionsItf *po) {
void Register(OptionsItf *opts) {
std::string module = "UbmClusteringOptions: ";
po->Register("max-am-gauss", &max_am_gauss, module+
"We first reduce acoustic model to this max #Gauss before clustering.");
po->Register("ubm-num-gauss", &ubm_num_gauss, module+
"Number of Gaussians components in the final UBM.");
po->Register("ubm-numcomps", &ubm_num_gauss, module+
"Backward compatibility option (see ubm-num-gauss)");
po->Register("reduce-state-factor", &reduce_state_factor, module+
"Intermediate number of clustered states (as fraction of total states).");
po->Register("intermediate-num-gauss", &intermediate_num_gauss, module+
"Intermediate number of merged Gaussian components.");
po->Register("intermediate-numcomps", &intermediate_num_gauss, module+
"Backward compatibility option (see intermediate-num-gauss)");
po->Register("cluster-varfloor", &cluster_varfloor, module+
"Variance floor used in bottom-up state clustering.");
opts->Register("max-am-gauss", &max_am_gauss, module+
"We first reduce acoustic model to this max #Gauss before clustering.");
opts->Register("ubm-num-gauss", &ubm_num_gauss, module+
"Number of Gaussians components in the final UBM.");
opts->Register("ubm-numcomps", &ubm_num_gauss, module+
"Backward compatibility option (see ubm-num-gauss)");
opts->Register("reduce-state-factor", &reduce_state_factor, module+
"Intermediate number of clustered states (as fraction of total states).");
opts->Register("intermediate-num-gauss", &intermediate_num_gauss, module+
"Intermediate number of merged Gaussian components.");
opts->Register("intermediate-numcomps", &intermediate_num_gauss, module+
"Backward compatibility option (see intermediate-num-gauss)");
opts->Register("cluster-varfloor", &cluster_varfloor, module+