diff --git a/src/FoLiA-correct.cxx b/src/FoLiA-correct.cxx index 440c2f3..4916e1e 100644 --- a/src/FoLiA-correct.cxx +++ b/src/FoLiA-correct.cxx @@ -1144,7 +1144,8 @@ void correctNgrams( FoliaElement *root, #else string inval; if ( ev.size() == 0 ){ - vector origV = root->select(false); + vector origV + = root->select(SELECT_FLAGS::LOCAL); if ( origV.empty() ){ // OK, no text directly // look deeper then @@ -1271,15 +1272,6 @@ void correctNgrams( FoliaElement *root, } } -template -vector upcast( const vector& v ){ - vector result; - for( const auto& it : v ){ - result.push_back(static_cast(it)); - } - return result; -} - bool correctDoc( Document *doc, const unordered_map >& variants, const unordered_set& unknowns, @@ -1294,11 +1286,14 @@ bool correctDoc( Document *doc, doc->declare( folia::AnnotationType::CORRECTION, setname, args ); vector ev; if ( tag_list.empty() ){ - vector v1 = upcast(doc->doc()->select()); - if ( v1.empty() ){ - v1 = upcast(doc->doc()->select() ); + vector vs = doc->doc()->select(); + if ( vs.empty() ){ + vector vp = doc->doc()->select(); + merge( ev, vp ); + } + else { + merge( ev, vs ); } - ev = v1; } else { for ( const auto& et : tag_list ){