question: private void cleaningText ( ) { int latinCount = 0 , nonLatinCount = 0 ; for ( int i = 0 ; i < text . length ( ) ; ++ i ) { char c = text . charAt ( i ) ; if ( c <= 'z' && c >= 'A' ) { ++ latinCount ; } else if ( c >= '̀' && UnicodeBlock . of ( c ) != UnicodeBlock . LATIN_EXTENDED_ADDITIONAL ) { ++ nonLatinCount ; } } if ( latinCount * 2 < nonLatinCount ) { StringBuffer textWithoutLatin = new StringBuffer ( ) ; for ( int i = 0 ; i < text . length ( ) ; ++ i ) { char c = text . charAt ( i ) ; if ( c > 'z' || c < 'A' ) textWithoutLatin . append ( c ) ; } text = textWithoutLatin ; } }
target:  Cleaning text to detect (eliminate URL, e-mail address and Latin sentence if it is not written in Latin alphabet)