24 int main(
int argc,
char *argv[]) {
27 using namespace kaldi;
30 "Sum accumulators for training of iVector extractor\n" 31 "Usage: ivector-extractor-sum-accs [options] <stats-in1> " 32 "<stats-in2> ... <stats-inN> <stats-out>\n";
35 bool parallel =
false;
37 po.
Register(
"binary", &binary,
"Write output in binary mode");
38 po.
Register(
"parallel", ¶llel,
"If true, the program makes sure to " 39 "open all filehandles before reading for any (useful when " 40 "summing accs from long processes)");
54 std::vector<kaldi::Input*> inputs(po.
NumArgs() - 1);
56 std::string stats_in_filename = po.
GetArg(
i);
65 stats.
Read(inputs[
i-1]->Stream(), b, add);
73 std::string stats_rxfilename = po.
GetArg(
i);
74 KALDI_LOG <<
"Reading stats from " << stats_rxfilename;
76 Input ki(stats_rxfilename, &binary_in);
83 KALDI_LOG <<
"Wrote summed stats to " << stats_wxfilename;
86 }
catch(
const std::exception &e) {
87 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
bool InitKaldiInputStream(std::istream &is, bool *binary)
Initialize an opened stream for reading by detecting the binary header and.
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
void Register(const std::string &name, bool *ptr, const std::string &doc)
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
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)