From df4545867c32ff1b8e48317c04ea39503dbe0767 Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 25 Aug 2015 11:48:36 +0800 Subject: repeat the last frame in lookup features --- kaldi_io/init.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kaldi_io/init.lua b/kaldi_io/init.lua index b66625e..a1496c4 100644 --- a/kaldi_io/init.lua +++ b/kaldi_io/init.lua @@ -54,6 +54,17 @@ function KaldiReader:get_data() local lookup_utter = repo:get_utter(self.feat_repo, transformed:nrow(), self.debug) + local nrow = lookup_utter:nrow() + if nrow < transformed:nrow() then + -- repeat the last frame + local nlu = lookup_utter:create(transformed:nrow()) + nlu:copy_from(lookup_utter, 0, nrow) + row = nlu[nrow - 1] + for i = 0, transformed:nrow() - nrow - 1 do + nlu:copy_from(nlu, nrow - 1, nrow, nrow + i) + end + lookup_utter = nlu + end res[id] = lookup_utter end -- move the pointer to next -- cgit v1.2.3-70-g09d2