From d7a6bc27d3fecc03c237f31267caf015ef0474aa Mon Sep 17 00:00:00 2001 From: kaisheny Date: Fri, 30 Jan 2015 15:37:10 -0800 Subject: [PATCH] GetIdFromLabel should only used for retrieval. Return error if a label is not found in vocabulary. --- DataReader/SequenceReader/SequenceReader.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/DataReader/SequenceReader/SequenceReader.cpp b/DataReader/SequenceReader/SequenceReader.cpp index 0a7e52e11d1a..6fe84a75eb7a 100644 --- a/DataReader/SequenceReader/SequenceReader.cpp +++ b/DataReader/SequenceReader/SequenceReader.cpp @@ -62,10 +62,7 @@ template // not yet found, add to the map if (found == labelInfo.mapLabelToId.end()) { - labelInfo.mapLabelToId[labelValue] = labelInfo.idMax; - labelInfo.mapIdToLabel[labelInfo.idMax] = labelValue; - found = labelInfo.mapLabelToId.find(labelValue); - labelInfo.idMax++; + RuntimeError("%s not in vocabulary", labelValue.c_str()); } return found->second; }