diff options
Diffstat (limited to 'htk_io')
-rw-r--r-- | htk_io/init.lua | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/htk_io/init.lua b/htk_io/init.lua index b836e15..abaa794 100644 --- a/htk_io/init.lua +++ b/htk_io/init.lua @@ -29,7 +29,31 @@ function TNetReader:get_data() end local res = {} -- read HTK feature - local feat_utter = self.feat_repo:cur_utter(self.debug) + local raw = self.gconf.cumat_type.new_from_host(self.feat_repo:cur_utter(self.debug)) + local rearranged + if self.frm_ext and self.frm_ext > 0 then + local step = self.frm_ext * 2 + 1 + -- expand the feature + local expanded = self.gconf.cumat_type(raw:nrow(), raw:ncol() * step) + expanded:expand_frm(raw, self.frm_ext) + -- rearrange the feature (``transpose'' operation in TNet) + if self.gconf.rearrange then + rearranged = expanded:create() + rearranged:rearrange_frm(expanded, step) + else + rearranged = expanded + end + else + rearranged = raw + end + local feat_utter + if self.gconf.frm_trim then + feat_utter = self.gconf.mmat_type(rearranged:nrow() - self.gconf.frm_trim * 2, rearranged:ncol()) + rearranged:copy_toh(feat_utter, self.gconf.frm_trim, rearranged:nrow() - self.gconf.frm_trim) + else + feat_utter = self.gconf.mmat_type(rearranged:nrow(), rearranged:ncol()) + rearranged:copy_toh(feat_utter) + end res[self.feat_id] = feat_utter -- add corresponding labels for id, repo in pairs(self.lab_repo) do |