26     const char *filename = 
"tmpf";
    27     std::ofstream outfile(filename, std::ios_base::out | std::ios_base::binary);
    29     if (!binary) outfile << 
"\t";
    30     int64 i1 = 
Rand() % 10000;
    32     uint16 i2 = 
Rand() % 10000;
    34     if (!binary) outfile << 
"\t";
    37     if (!binary && 
Rand()%2 == 0) outfile << 
" \n";
    38     std::vector<int32> vec1;
    40     if (!binary && 
Rand()%2 == 0) outfile << 
" \n";
    41     std::vector<uint16> vec2;
    42     for (
size_t i = 0; 
i < 10; 
i++) vec2.push_back(
Rand()%100 - 10);
    44     if (!binary) outfile << 
" \n";
    45     std::vector<char> vec3;
    48     for (
size_t i = 0; 
i < size; 
i++) vec3.push_back(
Rand()%100);
    50     std::vector<std::pair<int32, int32> > vec4;
    52     if (!binary && 
Rand()%2 == 0) outfile << 
" \n";
    53     std::vector<std::pair<uint16, uint16> > vec5;
    54     for (
size_t i = 0; 
i < size; 
i++) vec5.push_back(std::make_pair<uint16, uint16>(
Rand()%100 - 10, 
Rand()%100 - 10));
    56     if (!binary) outfile << 
" \n";
    57     std::vector<std::pair<char, char> > vec6;
    58     for (
size_t i = 0; 
i < size; 
i++) vec6.push_back(std::make_pair<char, char>(
Rand()%100, 
Rand()%100));
    60     if (!binary && 
Rand()%2 == 0) outfile << 
" \n";
    61     const char *token1 = 
"Hi";
    63     if (!binary) outfile << 
" \n";
    64     std::string token2 = 
"There.";
    66     if (!binary && 
Rand()%2 == 0) outfile << 
" \n";
    67     std::string token3 = 
"You.";
    69     if (!binary && 
Rand()%2 == 0) outfile << 
" ";
    72     if (!binary && 
Rand()%2 == 0) outfile << 
"\t";
    77     if (!binary && 
Rand()%2 == 0) outfile << 
"\t";
    80     if (!binary && 
Rand()%2 == 0) outfile << 
"\t";
    84       std::ifstream infile(filename, std::ios_base::in | std::ios_base::binary);
    96       std::vector<int32> vec1_in;
    99       std::vector<uint16> vec2_in;
   102       std::vector<char> vec3_in;
   105       std::vector<std::pair<int32, int32> > vec4_in;
   108       std::vector<std::pair<uint16, uint16> > vec5_in;
   111       std::vector<std::pair<char, char> > vec6_in;
   114       std::string  token1_in, token2_in;
   120       ReadToken(infile, binary_in, &token1_in);
   122       ReadToken(infile, binary_in, &token2_in);
   152   using namespace kaldi;
   153   for (
size_t i = 0; 
i < 10; 
i++) {
 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 WriteIntegerPairVector(std::ostream &os, bool binary, const std::vector< std::pair< T, T > > &v)
Function for writing STL vectors of pairs of integer types. 
 
float RandUniform(struct RandomState *state=NULL)
Returns a random number strictly between 0 and 1. 
 
void ReadBasicType(std::istream &is, bool binary, T *t)
ReadBasicType is the name of the read function for bool, integer types, and floating-point types...
 
void ReadToken(std::istream &is, bool binary, std::string *str)
ReadToken gets the next token and puts it in str (exception on failure). 
 
void UnitTestIo(bool binary)
 
void ReadIntegerPairVector(std::istream &is, bool binary, std::vector< std::pair< T, T > > *v)
Function for reading STL vector of pairs of integer types. 
 
int Peek(std::istream &is, bool binary)
Peek consumes whitespace (if binary == false) and then returns the peek() value of the stream...
 
void ReadIntegerVector(std::istream &is, bool binary, std::vector< T > *v)
Function for reading STL vector of integer types. 
 
void ExpectToken(std::istream &is, bool binary, const char *token)
ExpectToken tries to read in the given token, and throws an exception on failure. ...
 
void WriteToken(std::ostream &os, bool binary, const char *token)
The WriteToken functions are for writing nonempty sequences of non-space characters. 
 
int PeekToken(std::istream &is, bool binary)
PeekToken will return the first character of the next token, or -1 if end of file. 
 
int Rand(struct RandomState *state)
 
#define KALDI_ASSERT(cond)
 
static void AssertEqual(float a, float b, float relative_tolerance=0.001)
assert abs(a - b) <= relative_tolerance * (abs(a)+abs(b)) 
 
void WriteIntegerVector(std::ostream &os, bool binary, const std::vector< T > &v)
Function for writing STL vectors of integer types. 
 
void WriteBasicType(std::ostream &os, bool binary, T t)
WriteBasicType is the name of the write function for bool, integer types, and floating-point types...
 
void InitKaldiOutputStream(std::ostream &os, bool binary)
InitKaldiOutputStream initializes an opened stream for writing by writing an optional binary header a...
 
int32 RandInt(int32 min_val, int32 max_val, struct RandomState *state)