aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortxh18 <cloudygooseg@gmail.com>2015-10-28 19:03:09 +0800
committertxh18 <cloudygooseg@gmail.com>2015-10-28 19:03:09 +0800
commitee036b113b43fa2c5ff0087190866fc93efa7b21 (patch)
treeb6a358bcbd01b76e0693e8d9ac017b9be4f1e198
parent2f410245517a62a37c3229174117ae319a042bff (diff)
doing
-rw-r--r--nerv/examples/lmptb/lmptb/lmseqreader.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/nerv/examples/lmptb/lmptb/lmseqreader.lua b/nerv/examples/lmptb/lmptb/lmseqreader.lua
index 0952842..edc3ff4 100644
--- a/nerv/examples/lmptb/lmptb/lmseqreader.lua
+++ b/nerv/examples/lmptb/lmptb/lmseqreader.lua
@@ -20,7 +20,7 @@ end
--Initialize all streams
function LMReader:open_file(fn)
if (self.fh ~= nil) then
- nerv.error("%s error: in open_file, file handle not nil.")
+ nerv.error("%s error: in open_file(fn is %s), file handle not nil.", self.log_pre, fn)
end
printf("%s opening file %s...\n", self.log_pre, fn)
self.fh = io.open(fn, "r")
@@ -40,6 +40,9 @@ function LMReader:refresh_stream(id)
if (st.store[st.head] ~= nil) then return end
if (self.fh == nil) then return end
local list = self.vocab:read_line(self.fh)
+ if (list[1] ~= self.vocab.sen_end_token or list[#list] ~= self.vocab.sen_end_token) then --check for cntk style input
+ nerv.error("sentence not begin or end with </s> : %s", table.tostring(list));
+ end
if (list == nil) then --file has end
printf("%s file expires, closing.\n", self.log_pre)
self.fh:close()