aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortxh18 <cloudygooseg@gmail.com>2016-01-21 14:33:07 +0800
committertxh18 <cloudygooseg@gmail.com>2016-01-21 14:33:07 +0800
commitceda23dff9e9204ad3061bd65a096ae33d94d757 (patch)
tree22e50999112b137849d4439dc33cf174edeb20a4
parente829ef9253dfece9ff9f599130bc625f1267e136 (diff)
tiny bug fix in LMVocab
-rw-r--r--nerv/examples/lmptb/grulm_ptb_main.lua4
-rw-r--r--nerv/examples/lmptb/lmptb/lmvocab.lua6
-rw-r--r--nerv/examples/lmptb/lstmlm_ptb_main.lua4
3 files changed, 6 insertions, 8 deletions
diff --git a/nerv/examples/lmptb/grulm_ptb_main.lua b/nerv/examples/lmptb/grulm_ptb_main.lua
index ef5d7f9..6095b12 100644
--- a/nerv/examples/lmptb/grulm_ptb_main.lua
+++ b/nerv/examples/lmptb/grulm_ptb_main.lua
@@ -388,10 +388,10 @@ nerv.LMUtil.wait(2)
math.randomseed(1)
-local vocab = nerv.LMVocab()
+local vocab = nerv.LMVocab(global_conf)
global_conf["vocab"] = vocab
nerv.printf("%s building vocab...\n", global_conf.sche_log_pre)
-global_conf.vocab:build_file(global_conf.vocab_fn, false)
+global_conf.vocab:build_file(global_conf.vocab_fn)
ppl_rec = {}
local final_iter = -1
diff --git a/nerv/examples/lmptb/lmptb/lmvocab.lua b/nerv/examples/lmptb/lmptb/lmvocab.lua
index 0e7ef3e..38bb18e 100644
--- a/nerv/examples/lmptb/lmptb/lmvocab.lua
+++ b/nerv/examples/lmptb/lmptb/lmvocab.lua
@@ -2,8 +2,6 @@ require 'lmptb.lmutil'
local Vocab = nerv.class("nerv.LMVocab")
-local printf = nerv.printf
-
local mysplit = function(inputstr, sep)
if sep == nil then
sep = "%s"
@@ -106,7 +104,7 @@ end
--fn: string
--Add all words in fn to the vocab
function Vocab:build_file(fn)
- printf("%s Vocab building on file %s...\n", self.log_pre, fn)
+ nerv.printf("%s Vocab building on file %s...\n", self.log_pre, fn)
local file = io.open(fn, "r")
while (true) do
local list = nerv.LMUtil.read_line(file)
@@ -119,7 +117,7 @@ function Vocab:build_file(fn)
end
end
file:close()
- printf("%s Building finished, vocab size now is %d.\n", self.log_pre, self:size())
+ nerv.printf("%s Building finished, vocab size now is %d.\n", self.log_pre, self:size())
end
--[[test
diff --git a/nerv/examples/lmptb/lstmlm_ptb_main.lua b/nerv/examples/lmptb/lstmlm_ptb_main.lua
index 9bdd5ff..5794476 100644
--- a/nerv/examples/lmptb/lstmlm_ptb_main.lua
+++ b/nerv/examples/lmptb/lstmlm_ptb_main.lua
@@ -390,10 +390,10 @@ nerv.LMUtil.wait(2)
math.randomseed(1)
-local vocab = nerv.LMVocab()
+local vocab = nerv.LMVocab(global_conf)
global_conf["vocab"] = vocab
nerv.printf("%s building vocab...\n", global_conf.sche_log_pre)
-global_conf.vocab:build_file(global_conf.vocab_fn, false)
+global_conf.vocab:build_file(global_conf.vocab_fn)
ppl_rec = {}
local final_iter = -1