Skip to content

Commit

Permalink
nished refactoring for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Ko van der Sloot authored and Ko van der Sloot committed Nov 27, 2018
1 parent 1bc57d3 commit cf443a7
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/ner_tagger_mod.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -337,19 +337,7 @@ void NERTagger::post_process( const vector<folia::Word*>& words,
++pos;
continue;
}
else {
size_t num_words = TiCC::split_at( it.first, ner, "-" );
if ( num_words != 2 ){
LOG << "expected <NER>-tag, got: " << it.first << endl;
throw runtime_error( "NER: unable to retrieve a NER tag from: "
+ it.first );
}
}
if ( ner[0] == "B" ||
( ner[0] == "I" && entity.empty() ) ||
( ner[0] == "I" && ner[1] != curNER ) ){
// an I without preceding B is handled as a B
// an I with a different TAG is also handled as a B
if ( it.first[0] == 'B' ){
if ( !entity.empty() ){
if ( debug > 1 ){
LOG << "B spit out " << curNER << endl;
Expand All @@ -358,6 +346,12 @@ void NERTagger::post_process( const vector<folia::Word*>& words,
addEntity( sent, entity, curNER );
entity.clear();
}
size_t num_words = TiCC::split_at( it.first, ner, "-" );
if ( num_words != 2 ){
LOG << "expected <NER>-tag, got: " << it.first << endl;
throw runtime_error( "NER: unable to retrieve a NER tag from: "
+ it.first );
}
curNER = ner[1];
}
entity.push_back( make_pair(words[pos++], it.second) );
Expand Down

0 comments on commit cf443a7

Please sign in to comment.