This group contains the Input and Output classes, which are provided to open streams for reading and writing in Kaldi code; for an explanation of how this fits into the bigger picture of Kaldi I/O, see How to open files in Kaldi. More...
Classes | |
class | Output |
class | Input |
Enumerations | |
enum | OutputType { kNoOutput, kFileOutput, kStandardOutput, kPipeOutput } |
enum | InputType { kNoInput, kFileInput, kStandardInput, kOffsetFileInput, kPipeInput } |
Functions | |
OutputType | ClassifyWxfilename (const std::string &wxfilename) |
ClassifyWxfilename interprets filenames as follows: More... | |
InputType | ClassifyRxfilename (const std::string &rxfilename) |
ClassifyRxfilenames interprets filenames for reading as follows: More... | |
template<class C > | |
void | ReadKaldiObject (const std::string &filename, C *c) |
template<> | |
void | ReadKaldiObject (const std::string &filename, Matrix< float > *m) |
template<> | |
void | ReadKaldiObject (const std::string &filename, Matrix< double > *m) |
template<class C > | |
void | WriteKaldiObject (const C &c, const std::string &filename, bool binary) |
std::string | PrintableRxfilename (const std::string &rxfilename) |
PrintableRxfilename turns the rxfilename into a more human-readable form for error reporting, i.e. More... | |
std::string | PrintableWxfilename (const std::string &wxfilename) |
PrintableWxfilename turns the wxfilename into a more human-readable form for error reporting, i.e. More... | |
This group contains the Input and Output classes, which are provided to open streams for reading and writing in Kaldi code; for an explanation of how this fits into the bigger picture of Kaldi I/O, see How to open files in Kaldi.
enum InputType |
Enumerator | |
---|---|
kNoInput | |
kFileInput | |
kStandardInput | |
kOffsetFileInput | |
kPipeInput |
Definition at line 105 of file kaldi-io.h.
enum OutputType |
Enumerator | |
---|---|
kNoOutput | |
kFileOutput | |
kStandardOutput | |
kPipeOutput |
Definition at line 89 of file kaldi-io.h.
InputType ClassifyRxfilename | ( | const std::string & | rxfilename | ) |
ClassifyRxfilenames interprets filenames for reading as follows:
Definition at line 138 of file kaldi-io.cc.
References kaldi::ClassifyRspecifier(), kaldi::ClassifyWspecifier(), rnnlm::d, KALDI_WARN, kaldi::kFileInput, kaldi::kNoInput, kaldi::kNoRspecifier, kaldi::kNoWspecifier, kaldi::kOffsetFileInput, kaldi::kPipeInput, and kaldi::kStandardInput.
Referenced by Input::OpenInternal(), and kaldi::UnitTestClassifyRxfilename().
OutputType ClassifyWxfilename | ( | const std::string & | wxfilename | ) |
ClassifyWxfilename interprets filenames as follows:
Definition at line 85 of file kaldi-io.cc.
References kaldi::ClassifyRspecifier(), kaldi::ClassifyWspecifier(), rnnlm::d, KALDI_WARN, kaldi::kFileOutput, kaldi::kNoOutput, kaldi::kNoRspecifier, kaldi::kNoWspecifier, kaldi::kPipeOutput, and kaldi::kStandardOutput.
Referenced by Output::Open(), TableWriterBothImpl< Holder >::Open(), kaldi::UnitTestClassifyWxfilename(), and Output::~Output().
std::string PrintableRxfilename | ( | const std::string & | rxfilename | ) |
PrintableRxfilename turns the rxfilename into a more human-readable form for error reporting, i.e.
it does quoting and escaping and replaces "" or "-" with "standard input".
Definition at line 61 of file kaldi-io.cc.
References ParseOptions::Escape().
Referenced by SequentialTableReaderArchiveImpl< Holder >::Close(), SequentialTableReaderScriptImpl< Holder >::EnsureObjectLoaded(), RandomAccessTableReaderSortedArchiveImpl< Holder >::FindKeyInternal(), kaldi::GetUtterancePairs(), RandomAccessTableReaderMapped< Holder >::HasKey(), RandomAccessTableReaderScriptImpl< Holder >::HasKeyInternal(), Input::Input(), main(), SequentialTableReaderArchiveImpl< Holder >::Next(), SequentialTableReaderScriptImpl< Holder >::Open(), PipeInputImpl::Open(), SequentialTableReaderArchiveImpl< Holder >::Open(), TableWriterScriptImpl< Holder >::Open(), RandomAccessTableReaderScriptImpl< Holder >::Open(), RandomAccessTableReaderArchiveImplBase< Holder >::Open(), Input::OpenInternal(), fst::ReadFstKaldi(), fst::ReadFstKaldiGeneric(), RandomAccessTableReaderArchiveImplBase< Holder >::ReadNextObject(), kaldi::ReadPhoneMap(), kaldi::ReadScriptFile(), kaldi::ReadSharedPhonesList(), kaldi::ReadSymbolList(), SequentialTableReaderScriptImpl< Holder >::Value(), RandomAccessTableReaderMapped< Holder >::Value(), RandomAccessTableReaderDSortedArchiveImpl< Holder >::Value(), RandomAccessTableReaderSortedArchiveImpl< Holder >::Value(), RandomAccessTableReaderUnsortedArchiveImpl< Holder >::Value(), TableWriterScriptImpl< Holder >::Write(), kaldi::WriteKaldiObject(), SequentialTableReaderArchiveImpl< Holder >::~SequentialTableReaderArchiveImpl(), and SequentialTableReaderScriptImpl< Holder >::~SequentialTableReaderScriptImpl().
std::string PrintableWxfilename | ( | const std::string & | wxfilename | ) |
PrintableWxfilename turns the wxfilename into a more human-readable form for error reporting, i.e.
it does quoting and escaping and replaces "" or "-" with "standard output".
Definition at line 73 of file kaldi-io.cc.
References ParseOptions::Escape().
Referenced by main(), Output::Open(), Output::Output(), kaldi::TypeThreeUsage(), kaldi::TypeTwoUsage(), TableWriterArchiveImpl< Holder >::Write(), TableWriterScriptImpl< Holder >::Write(), TableWriterBothImpl< Holder >::Write(), fst::WriteFstKaldi(), kaldi::WriteKaldiObject(), kaldi::WriteScriptFile(), Output::~Output(), and PipeOutputImpl::~PipeOutputImpl().
void kaldi::ReadKaldiObject | ( | const std::string & | filename, |
C * | c | ||
) |
Definition at line 239 of file kaldi-io.h.
References kaldi::ReadKaldiObject(), and Input::Stream().
Definition at line 832 of file kaldi-io.cc.
References kaldi::ExtractObjectRange(), kaldi::ExtractRangeSpecifier(), KALDI_ERR, Matrix< Real >::Read(), and Input::Stream().
Referenced by ComputeLogPosteriors(), ComputeScores(), ConvolutionComponent::Init(), OnlineIvectorExtractionInfo::Init(), AffineComponent::Init(), AffineComponentPreconditioned::Init(), AffineComponentPreconditionedOnline::Init(), PerElementScaleComponent::Init(), Convolutional1dComponent::Init(), NaturalGradientAffineComponent::InitFromConfig(), LinearComponent::InitFromConfig(), FixedScaleComponent::InitFromConfig(), FixedBiasComponent::InitFromConfig(), PerElementOffsetComponent::InitFromConfig(), FixedScaleComponent::InitFromString(), FixedBiasComponent::InitFromString(), main(), OnlineFeaturePipeline::OnlineFeaturePipeline(), OnlineNnet2FeaturePipeline::OnlineNnet2FeaturePipeline(), kaldi::ReadKaldiObject(), kaldi::ReadModels(), kaldi::RunPerSpeaker(), and kaldi::TypeThreeUsage().
void ReadKaldiObject | ( | const std::string & | filename, |
Matrix< double > * | m | ||
) |
Definition at line 857 of file kaldi-io.cc.
References kaldi::ExtractObjectRange(), kaldi::ExtractRangeSpecifier(), KALDI_ERR, Matrix< Real >::Read(), and Input::Stream().
|
inline |
Definition at line 257 of file kaldi-io.h.
References kaldi::PrintableRxfilename(), kaldi::PrintableWxfilename(), and Output::Stream().
Referenced by kaldi::BuildConstArpaLm(), main(), kaldi::TypeThreeUsage(), kaldi::TypeTwoUsage(), kaldi::nnet2::UnitTestAffineComponent(), kaldi::nnet2::UnitTestAffineComponentPreconditioned(), kaldi::nnet2::UnitTestAffineComponentPreconditionedOnline(), kaldi::nnet2::UnitTestConvolutional1dComponent(), kaldi::WriteAsKaldiVector(), and NnetLdaStatsAccumulator::WriteStats().