@Test public void testNormalization() throws IOException { assertEquals("ANIMALS", HigherTaxaComparator.norm("Animals")); assertEquals("ANIMALS", HigherTaxaComparator.norm(" Animals")); assertEquals("ANIMALS", HigherTaxaComparator.norm("12Animals???")); assertEquals("DRECKS ASTERACEAE", HigherTaxaComparator.norm("drecks Asteraceae")); assertNull(HigherTaxaComparator.norm(null)); assertNull(HigherTaxaComparator.norm(" ")); assertNull(HigherTaxaComparator.norm("321")); assertNull(HigherTaxaComparator.norm("")); assertNull(HigherTaxaComparator.norm(",.-öä? ")); }
@VisibleForTesting protected static String norm(String x) { Pattern REMOVE_NON_LETTERS = Pattern.compile("[\\W\\d]+"); x = Strings.nullToEmpty(x); x = REMOVE_NON_LETTERS.matcher(x).replaceAll(" "); x = StringUtils.normalizeSpace(x).toUpperCase(); return StringUtils.trimToNull(x); }
HigherTaxaComparator { @VisibleForTesting protected static String norm(String x) { Pattern REMOVE_NON_LETTERS = Pattern.compile("[\\W\\d]+"); x = Strings.nullToEmpty(x); x = REMOVE_NON_LETTERS.matcher(x).replaceAll(" "); x = StringUtils.normalizeSpace(x).toUpperCase(); return StringUtils.trimToNull(x); } }
HigherTaxaComparator { @VisibleForTesting protected static String norm(String x) { Pattern REMOVE_NON_LETTERS = Pattern.compile("[\\W\\d]+"); x = Strings.nullToEmpty(x); x = REMOVE_NON_LETTERS.matcher(x).replaceAll(" "); x = StringUtils.normalizeSpace(x).toUpperCase(); return StringUtils.trimToNull(x); } HigherTaxaComparator(); }
HigherTaxaComparator { @VisibleForTesting protected static String norm(String x) { Pattern REMOVE_NON_LETTERS = Pattern.compile("[\\W\\d]+"); x = Strings.nullToEmpty(x); x = REMOVE_NON_LETTERS.matcher(x).replaceAll(" "); x = StringUtils.normalizeSpace(x).toUpperCase(); return StringUtils.trimToNull(x); } HigherTaxaComparator(); int compareHigherRank(Rank rank, LinneanClassification query, LinneanClassification ref, int match, int mismatch, int missing); boolean isInKingdoms(LinneanClassification n, Kingdom ... kingdoms); boolean isBlacklisted(String name); void loadLocalDicts(File folder); void loadClasspathDicts(String classpathFolder); void loadOnlineDicts(); void setSynonyms(Rank rank, Map<String, String> synonyms); int size(); int size(Rank rank); Kingdom toKingdom(String kingdom); }
HigherTaxaComparator { @VisibleForTesting protected static String norm(String x) { Pattern REMOVE_NON_LETTERS = Pattern.compile("[\\W\\d]+"); x = Strings.nullToEmpty(x); x = REMOVE_NON_LETTERS.matcher(x).replaceAll(" "); x = StringUtils.normalizeSpace(x).toUpperCase(); return StringUtils.trimToNull(x); } HigherTaxaComparator(); int compareHigherRank(Rank rank, LinneanClassification query, LinneanClassification ref, int match, int mismatch, int missing); boolean isInKingdoms(LinneanClassification n, Kingdom ... kingdoms); boolean isBlacklisted(String name); void loadLocalDicts(File folder); void loadClasspathDicts(String classpathFolder); void loadOnlineDicts(); void setSynonyms(Rank rank, Map<String, String> synonyms); int size(); int size(Rank rank); Kingdom toKingdom(String kingdom);  }