Changeset 13836 in josm for trunk/src/org/openstreetmap/josm/data/validation
- Timestamp:
- 2018-05-26T00:47:08+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java
r13390 r13836 7 7 8 8 import java.awt.geom.Point2D; 9 import java.text.Normalizer;10 9 import java.util.ArrayList; 11 10 import java.util.Arrays; … … 25 24 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 26 25 import org.openstreetmap.josm.tools.MultiMap; 26 import org.openstreetmap.josm.tools.Utils; 27 27 28 28 /** … … 35 35 36 36 protected static final int SIMILAR_NAMED = 701; 37 38 private static final Pattern REMOVE_DIACRITICS = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");39 37 40 38 /** All ways, grouped by cells */ … … 207 205 // check if only the case differs, so we don't consider large distance as different strings 208 206 if (distance > 2 && name.length() == name2.length()) { 209 similar = deAccent(name).equalsIgnoreCase(deAccent(name2));207 similar = Utils.deAccent(name).equalsIgnoreCase(Utils.deAccent(name2)); 210 208 } 211 209 … … 225 223 226 224 /** 227 * Removes diacritics (accents) from string.228 * @param str string229 * @return {@code str} without any diacritic (accent)230 * @since 12283231 */232 public static String deAccent(String str) {233 // https://stackoverflow.com/a/1215117/2257172234 return REMOVE_DIACRITICS.matcher(Normalizer.normalize(str, Normalizer.Form.NFD)).replaceAll("");235 }236 237 /**238 225 * A normalization that is applied to names before testing them 239 226 */
Note:
See TracChangeset
for help on using the changeset viewer.