27 int main(
int argc,
char *argv[]) {
29 using namespace kaldi;
32 typedef kaldi::uint64 uint64;
35 "Reads kaldi archive of FSTs; for each element, performs the project\n" 36 "operation either on input (default) or on the output (if the option\n" 37 "--project-output is true).\n" 39 "Usage: fsts-project [options] <fsts-rspecifier> <fsts-wspecifier>\n" 40 " e.g.: fsts-project ark:train.fsts ark,t:train.fsts\n" 42 "see also: fstproject (from the OpenFst toolkit)\n";
46 bool project_output =
false;
48 po.
Register(
"project-output", &project_output,
49 "If true, project output vs input");
58 std::string fsts_rspecifier = po.
GetArg(1),
59 fsts_wspecifier = po.
GetArg(2);
66 for (; !fst_reader.
Done(); fst_reader.
Next()) {
67 std::string key = fst_reader.
Key();
68 VectorFst<StdArc>
fst(fst_reader.
Value());
70 Project(&
fst, project_output ? PROJECT_OUTPUT : PROJECT_INPUT);
76 KALDI_LOG <<
"Projected " << n_done <<
" FSTs";
77 return (n_done != 0 ? 0 : 1);
78 }
catch(
const std::exception &e) {
79 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
int main(int argc, char *argv[])
For an extended explanation of the framework of which grammar-fsts are a part, please see Support for...
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
A templated class for writing objects to an archive or script file; see The Table concept...
void Write(const std::string &key, const T &value) const
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...
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
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).