Skip to content

Commit

Permalink
fix bug in parser double release model, add file exist check
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneplus committed Aug 31, 2013
1 parent b2b1fb9 commit 3d85cef
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/ner/ner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,10 @@ void NER::train(void) {
const char * train_file = train_opt.train_file.c_str();

// read in training instance
read_instance(train_file);
if (!read_instance(train_file)) {
ERROR_LOG("Training file doesn't exist");
}

TRACE_LOG("Read in [%d] instances.", train_dat.size());

model = new Model;
Expand Down
1 change: 1 addition & 0 deletions src/parser/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ void Parser::train(void) {
}

delete model;
model = 0;
}

void Parser::evaluate(void) {
Expand Down
5 changes: 4 additions & 1 deletion src/postagger/postagger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,10 @@ void Postagger::train(void) {
const char * train_file = train_opt.train_file.c_str();

// read in training instance
read_instance(train_file);
if (!read_instance(train_file)) {
ERROR_LOG("Training file doesn't exist.");
}

TRACE_LOG("Read in [%d] instances.", train_dat.size());

model = new Model;
Expand Down
5 changes: 4 additions & 1 deletion src/segmentor/segmentor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,10 @@ void Segmentor::train(void) {
const char * train_file = train_opt.train_file.c_str();

// read in training instance
read_instance(train_file);
if (!read_instance(train_file)) {
ERROR_LOG("Training file not exist.");
return;
}
TRACE_LOG("Read in [%d] instances.", train_dat.size());

model = new Model;
Expand Down

0 comments on commit 3d85cef

Please sign in to comment.