Skip to content

Commit

Permalink
some small fixes suggested by CppCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed Jun 9, 2023
1 parent b9d9251 commit c63ab45
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/AlpinoParser.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ dp_tree *parse_node( xmlNode *node ){
if ( !dp->word.empty() ){
dp->word_index = dp->end;
}
else {
dp->word_index = 0;
}
dp->link = 0;
dp->next = 0;
// cerr << "created dp_tree: " << dp << endl;
Expand Down
11 changes: 10 additions & 1 deletion src/ckyparser.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ void CKYParser::parse(){
bestI = r;
}
}
if ( bestI < 0 ){
string msg = "bestI index out of bounds in: ";
msg += __FILE__ + string(":") + std::to_string(__LINE__);
throw logic_error( msg );
}
DBG << "STEP 3 ADD: " << bestScore <<"-" << bestI << "-" << bestL << endl;
chart[s][t].l_True = SubTree( bestScore, bestI, bestL );
chart[s][t].l_True.satisfiedConstraints.insert( chart[s][bestI].l_True.satisfiedConstraints.begin(), chart[s][bestI].l_True.satisfiedConstraints.end() );
Expand All @@ -284,7 +289,11 @@ void CKYParser::parse(){
bestI = r;
}
}

if ( bestI < 0 ){
string msg = "bestI index out of bounds in: ";
msg += __FILE__ + string(":") + std::to_string(__LINE__);
throw logic_error( msg );
}
DBG << "STEP 4 ADD: " << bestScore <<"-" << bestI << "-" << bestL << endl;
chart[s][t].r_True = SubTree( bestScore, bestI, bestL );
chart[s][t].r_True.satisfiedConstraints.insert( chart[s][bestI].r_False.satisfiedConstraints.begin(), chart[s][bestI].r_False.satisfiedConstraints.end() );
Expand Down
2 changes: 1 addition & 1 deletion src/ner_tagger_mod.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ vector<UnicodeString> NERTagger::create_ner_list( const vector<UnicodeString>& w
size_t len = 1;
for ( size_t i = 0; i < min( words.size() - j, (size_t)max_ner_size); ++i ){
// start looking for sequences of length len
auto const& mp = ners[len++];
auto const mp = ners[len++];
if ( mp.empty() ){
continue;
}
Expand Down

0 comments on commit c63ab45

Please sign in to comment.