27 #include "fst/fstlib.h" 29 int main(
int argc,
char *argv[]) {
30 using namespace kaldi;
34 "Converts alignments (containing transition-ids) to pdf-ids, zero-based.\n" 35 "Usage: ali-to-pdf [options] <model> <alignments-rspecifier> <pdfs-wspecifier>\n" 37 " ali-to-pdf 1.mdl ark:1.ali ark,t:-\n";
47 std::string model_filename = po.
GetArg(1),
48 alignments_rspecifier = po.
GetArg(2),
49 pdfs_wspecifier = po.
GetArg(3);
58 for (; !reader.
Done(); reader.
Next()) {
59 std::string key = reader.
Key();
60 std::vector<int32> alignment = reader.
Value();
62 for (
size_t i = 0;
i < alignment.size();
i++)
65 writer.
Write(key, alignment);
68 KALDI_LOG <<
"Converted " << num_done <<
" alignments to pdf sequences.";
69 }
catch(
const std::exception &e) {
70 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature 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...
int32 TransitionIdToPdf(int32 trans_id) const
void Write(const std::string &key, const T &value) const
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
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).
int main(int argc, char *argv[])
Converts alignments (containing transition-ids) to pdf-ids, zero-based.