private String normalize(String str){
  str=StringUtils.trimToEmpty(str);
  str=StringUtils.normalizeSpace(str);
  str=str.replaceAll("\\s+(?=[.!,\\?;:])","");
  return str;
}

private String normalize ( String str ) { str = StringUtils . trimToEmpty ( str ) ; str = StringUtils . normalizeSpace ( str ) ; str = str . replaceAll ( "\\s+(?=[.!,\\?;:])" , "" ) ; return str ; }
normalizes the strings in the textpair . this mainly deals with whitespace - issues . other normalizations can be included .
