diff options
author | Determinant <[email protected]> | 2015-08-25 11:48:36 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2015-08-25 11:48:36 +0800 |
commit | df4545867c32ff1b8e48317c04ea39503dbe0767 (patch) | |
tree | d2e2d50bd10fafb6319b36720b2d574c62aae0ed /kaldi_io/init.lua | |
parent | 49caeba74bd90f359e3d0831df5f4e3613b03e99 (diff) |
repeat the last frame in lookup features
Diffstat (limited to 'kaldi_io/init.lua')
-rw-r--r-- | kaldi_io/init.lua | 11 |
1 files changed, 11 insertions, 0 deletions
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 |