28 using namespace kaldi;
31 "Copy vectors of integers, or archives of vectors of integers \n" 34 "Usage: copy-int-vector [options] (vector-in-rspecifier|vector-in-rxfilename) (vector-out-wspecifier|vector-out-wxfilename)\n" 35 " e.g.: copy-int-vector --binary=false foo -\n" 36 " copy-int-vector ark:1.ali ark,t:-\n";
41 po.Register(
"binary", &binary,
"Write in binary mode (only relevant if output is a wxfilename)");
45 if (po.NumArgs() != 2) {
51 std::string vector_in_fn = po.GetArg(1),
52 vector_out_fn = po.GetArg(2);
56 bool in_is_rspecifier =
63 if (in_is_rspecifier != out_is_wspecifier)
64 KALDI_ERR <<
"Cannot mix archives with regular files (copying vectors)";
66 if (!in_is_rspecifier) {
67 std::vector<int32> vec;
70 Input ki(vector_in_fn, &binary_in);
73 Output ko(vector_out_fn, binary);
75 KALDI_LOG <<
"Copied vector to " << vector_out_fn;
81 for (; !reader.Done(); reader.Next(), num_done++)
82 writer.Write(reader.Key(), reader.Value());
83 KALDI_LOG <<
"Copied " << num_done <<
" vectors of int32.";
84 return (num_done != 0 ? 0 : 1);
86 }
catch(
const std::exception &e) {
87 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
A templated class for writing objects to an archive or script file; see The Table concept...
RspecifierType ClassifyRspecifier(const std::string &rspecifier, std::string *rxfilename, RspecifierOptions *opts)
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void ReadIntegerVector(std::istream &is, bool binary, std::vector< T > *v)
Function for reading STL vector of integer types.
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
WspecifierType ClassifyWspecifier(const std::string &wspecifier, std::string *archive_wxfilename, std::string *script_wxfilename, WspecifierOptions *opts)
void WriteIntegerVector(std::ostream &os, bool binary, const std::vector< T > &v)
Function for writing STL vectors of integer types.