aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()