private String normalize ( String str ) { str = StringUtils . trimToEmpty ( str ) ; str = StringUtils . normalizeSpace ( str ) ; // remove whitespace before punctuation. not using \p{Punct}, // because it includes to many special characters. str = str . replaceAll ( "\\s+(?=[.!,\\?;:])" , "" ) ; return str ; }
Normalizes the Strings in the TextPair . This mainly deals with whitespace - issues . Other normalizations can be included .