25 int main(
int argc,
char *argv[]) {
26 using namespace kaldi;
30 "Estimate LDA transform using stats obtained with acc-lda.\n" 31 "Usage: est-lda [options] <lda-matrix-out> <lda-acc-1> <lda-acc-2> ...\n";
34 std::string full_matrix_wxfilename;
37 po.
Register(
"binary", &binary,
"Write matrix in binary mode.");
38 po.
Register(
"write-full-matrix", &full_matrix_wxfilename,
39 "Write full LDA matrix to this location.");
49 std::string lda_mat_wxfilename = po.
GetArg(1);
52 bool binary_in, add =
true;
54 lda.
Read(ki.Stream(), binary_in, add);
59 lda.
Estimate(opts, &lda_mat, &full_lda_mat);
61 if (full_matrix_wxfilename !=
"") {
62 Output ko(full_matrix_wxfilename, binary);
66 }
catch(
const std::exception &e) {
67 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void Write(std::ostream &out, bool binary) const
write to stream.
Class for computing linear discriminant analysis (LDA) transform.
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
int main(int argc, char *argv[])
void Register(const std::string &name, bool *ptr, const std::string &doc)
void Estimate(const LdaEstimateOptions &opts, Matrix< BaseFloat > *M, Matrix< BaseFloat > *Mfull=NULL) const
Estimates the LDA transform matrix m.
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void Read(std::istream &in_stream, bool binary, bool add)
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables.
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility.
int NumArgs() const
Number of positional parameters (c.f. argc-1).
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)
void Register(OptionsItf *opts)