30 if (!ki.Stream().good())
KALDI_ERR <<
"Could not open decoding-graph FST " 34 if (!hdr.Read(ki.Stream(),
"<unknown>")) {
35 KALDI_ERR <<
"Reading FST: error reading FST header.";
37 if (hdr.ArcType() != fst::StdArc::Type()) {
38 KALDI_ERR <<
"FST with arc type " << hdr.ArcType() <<
" not supported.\n";
40 fst::FstReadOptions ropts(
"<unspecified>", &hdr);
42 fst::Fst<fst::StdArc> *decode_fst = NULL;
44 if (hdr.FstType() ==
"vector") {
45 decode_fst = fst::VectorFst<fst::StdArc>::Read(ki.Stream(), ropts);
46 }
else if (hdr.FstType() ==
"const") {
47 decode_fst = fst::ConstFst<fst::StdArc>::Read(ki.Stream(), ropts);
49 KALDI_ERR <<
"Reading FST: unsupported FST type: " << hdr.FstType();
51 if (decode_fst == NULL) {
52 KALDI_ERR <<
"Error reading FST (after reading header).";
61 const fst::SymbolTable *word_syms,
64 for (
size_t i = 0;
i < words.size();
i++) {
65 std::string word = word_syms->Find(words[
i]);
67 KALDI_ERR <<
"Word-id " << words[
i] <<
" not in symbol table.";
68 std::cout << word <<
' ';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void PrintPartialResult(const std::vector< int32 > &words, const fst::SymbolTable *word_syms, bool line_break)
fst::Fst< fst::StdArc > * ReadDecodeGraph(const std::string &filename)
#define KALDI_ASSERT(cond)