github上有一些project可以看看,tbright17/kaldi-dnn-ali-gop​github.com

BaseFloat GmmGop::Decode(fst::VectorFst<:stdarc> &fst,

DecodableAmDiagGmmScaled &decodable,

std::vector *align) {

FasterDecoderOptions decode_opts;

decode_opts.beam = 2000; // number of beams for decoding. Larger, slower and more successful alignments. Smaller, more unsuccessful alignments.

FasterDecoder decoder(fst, decode_opts);

decoder.Decode(&decodable);

if (! decoder.ReachedFinal()) {

KALDI_WARN << "Did not successfully decode.";

}

fst::VectorFst decoded;

decoder.GetBestPath(&decoded);

std::vector osymbols;

LatticeWeight weight;

GetLinearSymbolSequence(decoded, align, &osymbols, &weight);

BaseFloat likelihood = -(weight.Value1()+weight.Value2());

return likelihood;

}

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐