Changeset 14531 in josm for trunk


Ignore:
Timestamp:
2018-12-09T08:15:46+01:00 (6 months ago)
Author:
GerdP
Message:

see #17055 improve TagChecker: Don't say "looks like" when all characters of given value are different, e.g. "Value '10' for key 'fee' looks like 'no'." makes no sense. The Levenshtein distance from 10 to no is only 2, but the length is also only 2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r14517 r14531  
    547547                            if (possibleVal.isEmpty())
    548548                                continue;
     549                            maxPresetValueLen = Math.max(maxPresetValueLen, possibleVal.length());
    549550                            if (harmonizedValue.length() < 3 && possibleVal.length() >= harmonizedValue.length() + MAX_LEVENSHTEIN_DISTANCE) {
    550551                                // don't suggest fix value when given value is short and lengths are too different
     
    552553                                continue;
    553554                            }
    554                             maxPresetValueLen = Math.max(maxPresetValueLen, possibleVal.length());
    555555                            int dist = Utils.getLevenshteinDistance(possibleVal, harmonizedValue);
     556                            if (dist >= harmonizedValue.length()) {
     557                                // short value, all characters are different. Don't warn, might say Value '10' for key 'fee' looks like 'no'.
     558                                continue;
     559                            }
    556560                            if (dist < minDist) {
    557561                                closest = possibleVal;
Note: See TracChangeset for help on using the changeset viewer.