FirstNameStandardize { public String replaceName(String inputName, boolean fuzzyQuery) throws IOException { ScoreDoc[] results = standardize(inputName, null, fuzzyQuery); return getFinalAccurateResult(inputName, results); } @Deprecated  FirstNameStandardize(IndexSearcher indexSearcher, Analyzer analyzer, int hitsPerPage);  FirstNameStandardize(IndexSearcher indexSearcher); @Deprecated void getFuzzySearch(String input, TopDocsCollector<?> collector); ScoreDoc[] standardize(String inputName, Map<String, String> information2value, boolean fuzzySearch); String replaceName(String inputName, boolean fuzzyQuery); String replaceNameWithCountryGenderInfo(String inputName, String inputCountry, String inputGender,
            boolean fuzzyQuery); String replaceNameWithCountryInfo(String inputName, String inputCountry, boolean fuzzyQuery); String replaceNameWithGenderInfo(String inputName, String inputGender, boolean fuzzyQuery); void setMaxEdits(int maxEdits); @Deprecated
    static final boolean SORT_WITH_COUNT; }
@Test public void testReplaceName() { try { String res = fnameStandardize.replaceName(inputName, true); System.out.println("testReplaceName:\n" + res); assertEquals("MICHEL", res); res = fnameStandardize.replaceNameWithCountryInfo(inputName, "ITA", true); assertEquals("MICHELE", res); res = fnameStandardize.replaceNameWithCountryInfo(inputName, "", true); assertEquals("MICHEL", res); res = fnameStandardize.replaceNameWithCountryGenderInfo(inputName, "ITA", "F", true); assertEquals("MICHELA", res); res = fnameStandardize.replaceNameWithCountryGenderInfo(inputName, "", "F", true); assertEquals("MICHEL", res); res = fnameStandardize.replaceNameWithCountryGenderInfo(inputName, "ITA", "", true); assertEquals("MICHELE", res); res = fnameStandardize.replaceNameWithGenderInfo(inputName, "F", true); assertEquals("MICHEL", res); res = fnameStandardize.replaceNameWithGenderInfo(inputName, "", true); assertEquals("MICHEL", res); res = fnameStandardize.replaceNameWithGenderInfo(inputName, "M", true); assertEquals("MICHEL", res); } catch (IOException e) { e.printStackTrace(); } }
@Test public void testReplaceNameWithFuzzyOption() { try { System.out.println("\ntestReplaceNameWithFuzzyOption:"); System.out.println("Name\tNon-fuzzy\tFuzzy"); for (String[] testCase : expected_fuzzy) { String res = ""; System.out.print("{\"" + testCase[0] + "\", \""); res = fnameStandardize.replaceName(testCase[0], false); System.out.print(res + "\", \""); assertEquals(testCase[1], res); res = fnameStandardize.replaceName(testCase[0], true); System.out.print(res + "\"},\n"); assertEquals(testCase[2], res); } } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }