"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "textline.cc" between
ocrad-0.25-pre5.tar.gz and ocrad-0.25-pre6.tar.gz

About: GNU Ocrad is an OCR (Optical Character Recognition) program. Pre-release.

textline.cc  (ocrad-0.25-pre5):textline.cc  (ocrad-0.25-pre6)
skipping to change at line 358 skipping to change at line 358
{ {
for( int i = characters() - 1; i >= 0; --i ) for( int i = characters() - 1; i >= 0; --i )
{ {
Character & c = character( i ); Character & c = character( i );
if( !c.guesses() ) continue; if( !c.guesses() ) continue;
c.apply_filter( filter ); c.apply_filter( filter );
if( !c.guesses() && filter != Filter::upper_num_mark ) if( !c.guesses() && filter != Filter::upper_num_mark )
{ delete_character( i ); modified = true; } { delete_character( i ); modified = true; }
} }
if( filter == Filter::upper_num_mark ) if( filter == Filter::upper_num_mark )
{ join_broken_unrecognized_characters();
for( int i = characters() - 1; i > 0; --i )
if( !character(i).guesses() &&
character(i).h_overlaps( character( i - 1 ) ) )
{ delete_character( i ); modified = true; }
}
} }
if( modified ) remove_leadind_trailing_duplicate_spaces(); if( modified ) remove_leadind_trailing_duplicate_spaces();
} }
void Textline::apply_user_filter( const User_filter & user_filter ) void Textline::apply_user_filter( const User_filter & user_filter )
{ {
bool modified = false; bool modified = false;
for( int i = characters() - 1; i >= 0; --i ) for( int i = characters() - 1; i >= 0; --i )
{ {
Character & c = character( i ); Character & c = character( i );
if( !c.guesses() ) continue; if( !c.guesses() ) continue;
c.apply_user_filter( user_filter ); c.apply_user_filter( user_filter );
if( !c.guesses() ) { delete_character( i ); modified = true; } if( !c.guesses() && user_filter.discard() )
{ delete_character( i ); modified = true; }
} }
if( user_filter.mark() ) join_broken_unrecognized_characters();
if( modified ) remove_leadind_trailing_duplicate_spaces(); if( modified ) remove_leadind_trailing_duplicate_spaces();
} }
void Textline::join_broken_unrecognized_characters()
{
for( int i = characters() - 1; i > 0; --i )
if( !character(i).guesses() &&
character(i).h_overlaps( character( i - 1 ) ) )
delete_character( i );
}
void Textline::remove_leadind_trailing_duplicate_spaces() void Textline::remove_leadind_trailing_duplicate_spaces()
{ {
for( int i = characters() - 1; i >= 0; --i ) for( int i = characters() - 1; i >= 0; --i )
if( character(i).maybe(' ') && if( character(i).maybe(' ') &&
( i == 0 || i == characters() - 1 || character(i-1).maybe(' ') ) ) ( i == 0 || i == characters() - 1 || character(i-1).maybe(' ') ) )
delete_character( i ); delete_character( i );
} }
 End of changes. 4 change blocks. 
7 lines changed or deleted 12 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS