From ee036b113b43fa2c5ff0087190866fc93efa7b21 Mon Sep 17 00:00:00 2001 From: txh18 Date: Wed, 28 Oct 2015 19:03:09 +0800 Subject: doing --- nerv/examples/lmptb/lmptb/lmseqreader.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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", table.tostring(list)); + end if (list == nil) then --file has end printf("%s file expires, closing.\n", self.log_pre) self.fh:close() -- cgit v1.2.3-70-g09d2