diff options
Diffstat (limited to 'fastnn/io/example.lua')
-rw-r--r-- | fastnn/io/example.lua | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/fastnn/io/example.lua b/fastnn/io/example.lua new file mode 100644 index 0000000..8808791 --- /dev/null +++ b/fastnn/io/example.lua @@ -0,0 +1,38 @@ + +local T = require 'libthreads' +local C = require 'libfastnn' + +local ExamplesRepo = nerv.class("fastnn.ExamplesRepo") +local Example = nerv.class("fastnn.Example") + +fastnn.CExamplesRepo = C.CExamplesRepo +fastnn.CExample = C.CExample + +function ExamplesRepo:__init(shareid) + if nil ~= shareid then + -- print(shareid) + self.repo = C.CExamplesRepo(shareid, true) + -- print(self.repo:__tostring()) + end +end + + +function Example:PrepareData(data, global_transf, trains_id) + local example = fastnn.CExample() + if nil ~= data then + for id, cm in pairs(data) do + if trains_id[id] and nil ~= global_transf then + local tcm = nerv.speech_utils.normalize(cm, global_transf) + example:pushback(tcm) + else + example:pushback(cm) + end + + end + end + + return example +end + + + |