Changeset 14571 in josm for trunk/src


Ignore:
Timestamp:
2018-12-17T15:08:05+01:00 (12 months ago)
Author:
GerdP
Message:

see #17055 When harmonized value is only 3 characters reduce allowed Levenshtein distance from 2 to 1.

When shop=gas is not in presets, we don't want a message like "Value 'gas' for key 'shop' looks like one of [bag, car, yes]."
just because one character of those values matches.

File:
1 edited

Legend:

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

    r14531 r14571  
    567567                            }
    568568                        }
    569                         if (minDist <= MAX_LEVENSHTEIN_DISTANCE && maxPresetValueLen > MAX_LEVENSHTEIN_DISTANCE) {
     569                        if (minDist <= MAX_LEVENSHTEIN_DISTANCE && maxPresetValueLen > MAX_LEVENSHTEIN_DISTANCE
     570                                && (harmonizedValue.length() > 3 || minDist < MAX_LEVENSHTEIN_DISTANCE)) {
    570571                            if (fixVals.size() < 2) {
    571572                                fixedValue = closest;
     
    575576                                errors.add(TestError.builder(this, Severity.WARNING, MISSPELLED_VALUE_NO_FIX)
    576577                                        .message(tr("Misspelled property value"),
    577                                                 marktr("Value ''{0}'' for key ''{1}'' looks like one of {2}."), prop.getValue(), key, fixVals)
    578                                         .primitives(p)
    579                                         .build());
     578                                                marktr("Value ''{0}'' for key ''{1}'' looks like one of {2}."),
     579                                                prop.getValue(), key, fixVals)
     580                                        .primitives(p).build());
    580581                                withErrors.put(p, "WPV");
    581582                                continue;
Note: See TracChangeset for help on using the changeset viewer.