Holder types are types that are used as template arguments to the Table types (see "Table types and related functions"), and which help the Table types to read and write the object of type SomeHolder::T; see Holders as helpers to Table classes for more information. More...
Classes | |
class | KaldiObjectHolder< KaldiType > |
KaldiObjectHolder works for Kaldi objects that have the "standard" Read and Write functions, and a copy constructor. More... | |
class | BasicHolder< BasicType > |
BasicHolder is valid for float, double, bool, and integer types. More... | |
class | BasicVectorHolder< BasicType > |
A Holder for a vector of basic types, e.g. More... | |
class | BasicVectorVectorHolder< BasicType > |
BasicVectorVectorHolder is a Holder for a vector of vector of a basic type, e.g. More... | |
class | BasicPairVectorHolder< BasicType > |
BasicPairVectorHolder is a Holder for a vector of pairs of a basic type, e.g. More... | |
class | TokenHolder |
class | TokenVectorHolder |
class | HtkMatrixHolder |
class | SphinxMatrixHolder< kFeatDim > |
A class for reading/writing Sphinx format matrices. More... | |
Functions | |
template<class T > | |
bool | ExtractObjectRange (const T &input, const std::string &range, T *output) |
This templated function exists so that we can write .scp files with 'object ranges' specified: the canonical example is a [first:last] range of rows of a matrix, or [first-row:last-row,first-column,last-column] of a matrix. More... | |
template<class Real > | |
bool | ExtractObjectRange (const Matrix< Real > &input, const std::string &range, Matrix< Real > *output) |
The template is specialized with a version that actually does something, for types Matrix<float> and Matrix<double>. More... | |
template<class Real > | |
bool | ExtractObjectRange (const Vector< Real > &input, const std::string &range, Vector< Real > *output) |
The template is specialized types Vector<float> and Vector<double>. More... | |
bool | ExtractObjectRange (const GeneralMatrix &input, const std::string &range, GeneralMatrix *output) |
GeneralMatrix is always of type BaseFloat. More... | |
template<class Real > | |
bool | ExtractObjectRange (const CompressedMatrix &input, const std::string &range, Matrix< Real > *output) |
CompressedMatrix is always of the type BaseFloat but it is more efficient to provide template as it uses CompressedMatrix's own conversion to Matrix<Real> More... | |
bool | ExtractRangeSpecifier (const std::string &rxfilename_with_range, std::string *data_rxfilename, std::string *range) |
Holder types are types that are used as template arguments to the Table types (see "Table types and related functions"), and which help the Table types to read and write the object of type SomeHolder::T; see Holders as helpers to Table classes for more information.
bool ExtractObjectRange | ( | const GeneralMatrix & | input, |
const std::string & | range, | ||
GeneralMatrix * | output | ||
) |
GeneralMatrix is always of type BaseFloat.
Definition at line 88 of file kaldi-holder.cc.
References GeneralMatrix::Clear(), GeneralMatrix::GetCompressedMatrix(), GeneralMatrix::GetFullMatrix(), GeneralMatrix::GetMatrix(), KALDI_ASSERT, kaldi::kCompressedMatrix, kaldi::kFullMatrix, kaldi::kSparseMatrix, GeneralMatrix::SwapFullMatrix(), and GeneralMatrix::Type().
Referenced by kaldi::ExtractObjectRange(), KaldiObjectHolder< KaldiType >::ExtractRange(), and kaldi::ReadKaldiObject().
bool ExtractObjectRange | ( | const CompressedMatrix & | input, |
const std::string & | range, | ||
Matrix< Real > * | output | ||
) |
CompressedMatrix is always of the type BaseFloat but it is more efficient to provide template as it uses CompressedMatrix's own conversion to Matrix<Real>
Definition at line 114 of file kaldi-holder.cc.
References CompressedMatrix::CopyToMat(), kaldi::ExtractObjectRange(), KALDI_ERR, kaldi::kUndefined, CompressedMatrix::NumCols(), CompressedMatrix::NumRows(), kaldi::ParseMatrixRangeSpecifier(), and Matrix< Real >::Resize().
bool ExtractObjectRange | ( | const Matrix< Real > & | input, |
const std::string & | range, | ||
Matrix< Real > * | output | ||
) |
The template is specialized with a version that actually does something, for types Matrix<float> and Matrix<double>.
We can later add versions of this template for other types, such as Vector, which can meaningfully have ranges extracted.
Definition at line 139 of file kaldi-holder.cc.
References MatrixBase< Real >::CopyFromMat(), kaldi::ExtractObjectRange(), KALDI_ERR, kaldi::kUndefined, MatrixBase< Real >::NumCols(), MatrixBase< Real >::NumRows(), kaldi::ParseMatrixRangeSpecifier(), MatrixBase< Real >::Range(), and Matrix< Real >::Resize().
bool ExtractObjectRange | ( | const Vector< Real > & | input, |
const std::string & | range, | ||
Vector< Real > * | output | ||
) |
The template is specialized types Vector<float> and Vector<double>.
Definition at line 164 of file kaldi-holder.cc.
References VectorBase< Real >::CopyFromVec(), VectorBase< Real >::Dim(), kaldi::ExtractObjectRange(), KALDI_ERR, KALDI_WARN, kaldi::kUndefined, VectorBase< Real >::Range(), Vector< Real >::Resize(), kaldi::SplitStringToIntegers(), and kaldi::SplitStringToVector().
bool kaldi::ExtractObjectRange | ( | const T & | input, |
const std::string & | range, | ||
T * | output | ||
) |
This templated function exists so that we can write .scp files with 'object ranges' specified: the canonical example is a [first:last] range of rows of a matrix, or [first-row:last-row,first-column,last-column] of a matrix.
We can also support [begin-time:end-time] of a wave file. The string 'range' is whatever is in the square brackets; it is parsed inside this function. This function returns true if the partial object was successfully extracted, and false if there was an error such as an invalid range. The generic version of this function just fails; we overload the template whenever we need it for a specific class.
Definition at line 233 of file kaldi-holder.h.
References kaldi::ExtractObjectRange(), kaldi::ExtractRangeSpecifier(), and KALDI_ERR.
bool ExtractRangeSpecifier | ( | const std::string & | rxfilename_with_range, |
std::string * | data_rxfilename, | ||
std::string * | range | ||
) |
Definition at line 213 of file kaldi-holder.cc.
References KALDI_ERR, and kaldi::SplitStringToVector().
Referenced by kaldi::ExtractObjectRange(), RandomAccessTableReaderScriptImpl< Holder >::HasKeyInternal(), SequentialTableReaderScriptImpl< Holder >::NextScpLine(), and kaldi::ReadKaldiObject().