@Test public void normalize_MANY_BRACKET_PAIRS() { String filtered = normalizer.normalize("(aa)some (bb)more complex(cc) text"); assertEquals("some more complex text", filtered); verify(innerNormalizer).normalize("some more complex text"); }
@Override public String normalize(String organizationName) { if (StringUtils.isBlank(organizationName)) { return ""; } String filteredOrganizationName = PatternUtils.removePattern(organizationName, "\\(.*?\\)"); filteredOrganizationName = innerNormalizer.normalize(filteredOrganizationName); for (String stopword : stopwords) { filteredOrganizationName = PatternUtils.removePattern(filteredOrganizationName, "\\b" + stopword + "\\b"); } filteredOrganizationName = filteredOrganizationName.trim().replaceAll(" +", " "); return filteredOrganizationName; }
OrganizationNameNormalizer implements StringNormalizer, Serializable { @Override public String normalize(String organizationName) { if (StringUtils.isBlank(organizationName)) { return ""; } String filteredOrganizationName = PatternUtils.removePattern(organizationName, "\\(.*?\\)"); filteredOrganizationName = innerNormalizer.normalize(filteredOrganizationName); for (String stopword : stopwords) { filteredOrganizationName = PatternUtils.removePattern(filteredOrganizationName, "\\b" + stopword + "\\b"); } filteredOrganizationName = filteredOrganizationName.trim().replaceAll(" +", " "); return filteredOrganizationName; } }
OrganizationNameNormalizer implements StringNormalizer, Serializable { @Override public String normalize(String organizationName) { if (StringUtils.isBlank(organizationName)) { return ""; } String filteredOrganizationName = PatternUtils.removePattern(organizationName, "\\(.*?\\)"); filteredOrganizationName = innerNormalizer.normalize(filteredOrganizationName); for (String stopword : stopwords) { filteredOrganizationName = PatternUtils.removePattern(filteredOrganizationName, "\\b" + stopword + "\\b"); } filteredOrganizationName = filteredOrganizationName.trim().replaceAll(" +", " "); return filteredOrganizationName; }  }
OrganizationNameNormalizer implements StringNormalizer, Serializable { @Override public String normalize(String organizationName) { if (StringUtils.isBlank(organizationName)) { return ""; } String filteredOrganizationName = PatternUtils.removePattern(organizationName, "\\(.*?\\)"); filteredOrganizationName = innerNormalizer.normalize(filteredOrganizationName); for (String stopword : stopwords) { filteredOrganizationName = PatternUtils.removePattern(filteredOrganizationName, "\\b" + stopword + "\\b"); } filteredOrganizationName = filteredOrganizationName.trim().replaceAll(" +", " "); return filteredOrganizationName; }  @Override String normalize(String organizationName); void setInnerNormalizer(StringNormalizer innerNormalizer); void setStopwords(Set<String> stopwords); }
OrganizationNameNormalizer implements StringNormalizer, Serializable { @Override public String normalize(String organizationName) { if (StringUtils.isBlank(organizationName)) { return ""; } String filteredOrganizationName = PatternUtils.removePattern(organizationName, "\\(.*?\\)"); filteredOrganizationName = innerNormalizer.normalize(filteredOrganizationName); for (String stopword : stopwords) { filteredOrganizationName = PatternUtils.removePattern(filteredOrganizationName, "\\b" + stopword + "\\b"); } filteredOrganizationName = filteredOrganizationName.trim().replaceAll(" +", " "); return filteredOrganizationName; }  @Override String normalize(String organizationName); void setInnerNormalizer(StringNormalizer innerNormalizer); void setStopwords(Set<String> stopwords);  }