Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 25 of file gmm-copy.cc.
References ParseOptions::GetArg(), KALDI_LOG, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), AmDiagGmm::Read(), ParseOptions::Read(), TransitionModel::Read(), ParseOptions::Register(), Output::Stream(), Input::Stream(), AmDiagGmm::Write(), and TransitionModel::Write().
27 using namespace kaldi;
31 "Copy GMM based model (and possibly change binary/text format)\n" 32 "Usage: gmm-copy [options] <model-in> <model-out>\n" 34 " gmm-copy --binary=false 1.mdl 1_txt.mdl\n";
37 bool binary_write =
true,
42 po.Register(
"binary", &binary_write,
"Write output in binary mode");
43 po.Register(
"copy-am", ©_am,
"Copy the acoustic model (AmDiagGmm object)");
44 po.Register(
"copy-tm", ©_tm,
"Copy the transition model");
48 if (po.NumArgs() != 2) {
53 std::string model_in_filename = po.GetArg(1),
54 model_out_filename = po.GetArg(2);
60 Input ki(model_in_filename, &binary_read);
62 trans_model.
Read(ki.Stream(), binary_read);
64 am_gmm.
Read(ki.Stream(), binary_read);
68 Output ko(model_out_filename, binary_write);
70 trans_model.
Write(ko.Stream(), binary_write);
72 am_gmm.
Write(ko.Stream(), binary_write);
75 KALDI_LOG <<
"Written model to " << model_out_filename;
76 }
catch(
const std::exception &e) {
77 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void Read(std::istream &is, bool binary)
void Write(std::ostream &os, bool binary) const
void Write(std::ostream &out_stream, bool binary) const
void Read(std::istream &in_stream, bool binary)