diff options
author | Determinant <[email protected]> | 2015-08-24 15:49:02 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2015-08-24 15:49:02 +0800 |
commit | 97425eb035b7e52918946f3799047fe48120d132 (patch) | |
tree | 7637e6411fdac936cf529f6f2aaf0fabc55c79c9 /kaldi_io/init.lua | |
parent | c3cffb58b9921d78753336421b52b9ffdaa5515c (diff) |
add lookup feature IOlookup-reader
Diffstat (limited to 'kaldi_io/init.lua')
-rw-r--r-- | kaldi_io/init.lua | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/kaldi_io/init.lua b/kaldi_io/init.lua index 9fdb080..b66625e 100644 --- a/kaldi_io/init.lua +++ b/kaldi_io/init.lua @@ -15,9 +15,20 @@ function KaldiReader:__init(global_conf, reader_conf) self.lab_repo = {} for id, mlf_spec in pairs(reader_conf.mlfs) do + if mlf_spec.format == nil then + nerv.error("format spec is expected for label %s", id) + end self.lab_repo[id] = nerv.KaldiLabelRepo(mlf_spec.targets_rspecifier, mlf_spec.format) end + self.lookup_repo = {} + for id, lookup_spec in pairs(reader_conf.lookup) do + if lookup_spec.map_rspecifier == nil then + nerv.error("map spec is expected for lookup %s", id) + end + self.lookup_repo[id] = nerv.KaldiLookupFeatureRepo(lookup_spec.targets_rspecifier, + lookup_spec.map_rspecifier) + end end function KaldiReader:get_data() @@ -34,11 +45,17 @@ function KaldiReader:get_data() -- add corresponding labels for id, repo in pairs(self.lab_repo) do local lab_utter = repo:get_utter(self.feat_repo, - self.frm_ext, transformed:nrow(), self.debug) res[id] = lab_utter end + -- add corresponding lookup features + for id, repo in pairs(self.lookup_repo) do + local lookup_utter = repo:get_utter(self.feat_repo, + transformed:nrow(), + self.debug) + res[id] = lookup_utter + end -- move the pointer to next self.feat_repo:next() collectgarbage("collect") |