Changeset 14490 in josm


Ignore:
Timestamp:
2018-12-02T16:04:34+01:00 (6 years ago)
Author:
GerdP
Message:

fix #17055 17055-v2.patch with one empty line removed

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/data/validator/words.cfg

    r6760 r14490  
    33# special symbols, must be first character:
    44#  # Comment
    5 #  + correctly spelled word
    6 #  - incorrectly spelled word. Must follow correctly spelled word before next correctly spelled word.
     5#  + correctly spelled key
     6#  - incorrectly spelled key. Must follow correctly spelled key before next correctly spelled key.
    77#
    88# There must not be any white space before or after words, unless they are to be included in
    99# the bad spelling.
     10# There is no need to add bad spelling with different upper/lower case.
     11# There is no need to add bad spelling with leading or trailing blanks.
     12
    1013+abutters
    1114-abuters
     
    1518-abuutters
    1619-ubutters
    17 +abutter
    18 +address
    19 +aka
    20 +ambulance
    2120+amenity
    2221-ameninty
     
    2726-amenitry
    2827-amnity
    29 -amenity
    3028-amentiy
    3129-aminity
     
    3735-ameinty
    3836-anemity
    39 -amneity
    4037-amemity
    4138-ameity
    42 -amenity:
    4339-amenty
    44 -Amenity
    4540-maenity
    4641-emenity
    47 +amenitylanduse
    48 +atm
    49 +Atta Oehlaweg
    5042+bicycle
    5143-bycycle
     
    5345-bycicle
    5446-bicyle
    55 +bike
    56 - bike
    57 +biological
    58 +by
    59 +City
    60 +class
    61 -Class
    62 +classification
    63 +ele
    64 +emity
    65 +email
    66 +code_departement
    67 +code_INSEE
     47-cycle
     48-bike
     49-bikes
    6850+commercial
    6951-comercial
    70 +comment
    71 +COMMENTLINE
    72 +confirmed
    7352+created_by
    74 -created by
    7553-cretaed_by
    7654-crated_by
     
    7856-creayed_by
    7957-{created_by
    80 - created_by
    8158-creeated_by
    8259-created_bu
    83 +crossing
    8460+denomination
    8561-denonimation
     
    9268-denominatation
    9369-denoination
    94 +domination
    95 +faith
    96 +footway
    9770+foot
    98 - foot
    9971-foor
    10072+height
     
    10274+highway
    10375-higwhay
     76-highways
    10477-highwaay
    105 -HighWay
    10678-huighway
    10779-highwayt
     
    11587-hihjway
    11688-higheway
    117 -highwaY
    11889-hughway
    11990-hihgway
     
    12495-higyway
    12596-hichway
    126 -HIGHWAY
    12797-hingway
    12898-hhighway
     
    134104-hihway
    135105-hifgway
    136 -highway:
    137106-highjway
    138 -highway
    139107-highwy
    140108-hgihway
     
    146114-higway
    147115-highwayx
    148 - highway
    149116-hoghway
    150117-highwa
    151 -Highway
    152118-hghway
    153 +highways
    154 +highspeed
    155 +highwaytype
    156 +highway_type
    157 +highwayunclassified
    158 +horse
    159 +hvg
    160 +iata_ref
    161 +icao_ref
    162 +IM2
    163119+image
    164120-imaqge
    165 +island
    166121+layer
    167 -layer
    168122-leyer
    169123-lyaer
    170 - layer
    171 +layer2
    172 +layers
    173 +layout
    174124+leisure
    175125-leissure
    176126-leiruse
    177127-lesure
    178 -leisure
    179 -Leisure
    180128-liesure
    181129-lieusure
    182130-lesiure
    183131-leasure
    184 +naam
    185132+name
    186133-nane
     
    196143-bame
    197144-nam
    198 - name
    199145-namr
    200 -name
    201146-anme
    202 -Name
    203 -name:
    204 -NAME
    205 -name;
    206 +name_1
    207 +name_4
    208 +named_by
    209 +names
    210 +name_right
    211 +name_left
    212 +note
    213 -Note
    214147+note:fa
    215148-note:fa
    216149-notes:fa
    217 +Number
    218150+oneway
    219151-aneway
     
    227159-one_way
    228160-onway
    229 - oneway
    230161-oeway
    231162-eway
    232 +onte
    233163+osmarender:nameDirection
    234164-name_direction
    235 -name-direction
    236165-osmarender:name_direction
    237 +place
    238 -place
    239 -Place
    240 +passing
    241 +passing_places
    242166+railway
    243 - railway
    244 -Railway
    245167-raillway
    246 +re
    247 +regional_name
    248 +ref
    249 -ref
    250 -ref:
    251 -Ref
    252 +ref:fa
    253 +ref:source
    254 +ref_nat
    255 +ref_int
    256 +retail
    257 +time
    258 +seats
    259 +seventh_wonder_of_world
    260 +square
    261 +soccer
    262168+source
    263169-sorce
     
    268174-aource
    269175-sourse
    270 +source2
    271 +source:ncn_ref
    272 +source:highway
    273 +SSSI
    274 +status
    275 +way
    276176+waterway
    277 - waterway
    278177-waterwa
    279 -Waterway
    280178-waterwy
    281179-wateway
    282 +wood
    283180+unknown
    284181-unknwon
     
    286183# Not sorted.
    287184#
    288 +
    289 +1
    290 +4wd
    291 + car
    292 + class
    293 + horse
    294 + sport
    295 + open 09:00 - 16:00 daily
    296 + General McArthur lived here
    297 + Also coaches
    298 +80n:ibm
    299 +amenities
    300 +bar
    301 +batteries
    302 +Bezeichnung
    303 +boder
    304 +Brand
    305 +Food
    306 +Fussweg
    307 +Hauptstrasse
    308 +POI
    309 +Park
    310 +Strasse
    311 +abutment
    312 +abutts
    313 +access
    314 +accident_and_emergency
    315 +active_volcano
    316185+aerialway
    317186-areilway
     
    322191-areoway
    323192-airoway
    324 +ageofdgpsdata
    325193+airport
    326194-aeroport
    327 +airport_ident
    328 +airport_ref
    329 +airway
    330 +alias
    331 +alt
    332 +altname
    333 +alt_name
    334 +alt_name_2
    335 +alternative_name
    336 +altitude
    337 +alt_ref
    338 +ame
    339 +annotation
    340 +annotate
    341 +angle
    342 +angle_to_last
    343 +appearance
    344 +approximate
    345 +area
    346 +art
    347 +ascii_name
    348 +asphalt
    349 +author
    350 +autocar
    351 +b test tag
    352 +badminton
    353 +barnvagn
    354 +barrier
    355 +bb:name
    356 +beach
    357 +bicycleRoute
    358 +bicycle_Route
    359 +blackadder:name
    360 +blackadder:commerce
    361 +blackadder:cuisine
    362 +blackadder:service
    363 +blackadder:civic
    364 +bicycles
    365 +boat
    366 +bogus_footpath_going_nowhere
    367 +border
    368 +borded
    369 +border_edit
    370 +border_type
    371 +bottles
    372 +boundary
    373 +boundary_name
    374 +boundary_type
    375 +branch
    376 +branch_code:fa
    377 +branch_name:fa
    378 +brand
    379 +brewery
    380195+bridge
    381196-brideg
    382 - bridge
    383197-brdige
    384198-bridgde
    385199-birdge
    386 -   bridge
    387200-bidge
    388201-brige
    389202-brigde
    390203-bridgw
    391 +bridge_ref
    392 +bridge_name
    393 +bridleway
    394204+building
    395205-buidling
     
    397207-buiding
    398208-bulding
    399 +building_name
    400 +build_date
    401 +bus
    402 +buss
    403 +busway
    404 +bus_routes
    405 +building_type
    406 +cafe
    407 +capacity
    408 +Car
    409 +car
    410 +carriage
    411 +cars
    412 +car park at rear
    413 - car park at rear
    414 +car_repair
    415 +carsharing
    416 +category
    417 +caution
    418 +charge
    419 +chemin
    420 +checked_by
    421 +cheshire_cycleway_ref
    422 +christian_denomination
    423 +cladding
     209-buildinq
    424210+city
    425211-citya
    426 +city_id
    427 +clinic
    428 +clothes
    429 +cmt
    430212+complete
    431 - complete
    432213-complite
    433 +condition
    434214+construction
    435 +controlled
    436 +converted_by
    437 +core
    438 +cost
    439 +country
    440 +course
    441 +cover
    442 +covered
    443 +creator
    444 +cycle
    445 -cyle
    446 +cycleRoute
    447 +cycle_route
     215-constrution
     216-contruction
    448217+cycleway
    449218-cylceway
    450 -cycleway:
    451 +cykel
    452 +cuisine
    453 +cusine
    454 +cutting
    455 +d_lat
    456 +d_lon
    457 +danger
    458 +date
    459 +date_off
    460 +day_off
    461 +day_on
    462 +dead-end
    463 +deadend
    464 +depth
    465 +desc
    466219+description
    467220-descripion
    468221-desription
    469222-decription
    470 +descriptions
    471 + details:naco
    472 +destination
    473 +difficulty
    474 +direction
    475 +direction_to
    476 +dispensing
    477 +distance
    478 +distance_meter
    479 +disused
    480 +ECautomaton
    481 +edited_some_more_by
    482 +editor
    483 +editor note
    484 +ef
    485 +elevated
    486 +embankment
    487 +emergency
    488 +emergency_ward
    489 +error
    490 +exit
    491 +exit_nr
    492 +exit_name
    493 +external_description
    494 +external_link
    495 +ev_charge
    496 +facility
    497 +farezone
    498 +farm_vehicles
    499 +fastfood
    500 +FACC_CODE
    501223+feature
    502224-featuer
    503 +feature: NGIA map
    504 - feature: NGIA map
    505 +features
    506 +feet
    507 +ferry
    508 +fenced
    509 +fire
    510 +first_number
    511 +fix
    512 +fixme
    513 +FIXME
    514 +foobar
    515 +food
    516 +footpath
    517 -fottpath
    518 +forrest
    519 +foto
    520 +free
    521225+freight
    522226-frieght
    523 +from_to
    524 +from_zip
    525 +fuel_diesel
    526 +fuel_lpg
    527 +fuel_octane_91
    528 +fuel_octane_95
    529 +fuel_octane_98
    530227+full_name:fa
    531228-full_name:Fa
    532 +full_name
    533 +gate
    534 +geoname_id
    535 +glass
    536 +glass_bottles
    537 +glutenfree
    538 +gluten_free
    539 +goods
    540 +gps_network
    541 +grade
    542 +grind
    543 +gym
    544 +halt
    545 +hazard
    546 +hame
    547 +has_postalcode
    548 +hdop
    549 +helped_by
    550 +heritage
    551 +hgv
    552 +highway E-number
    553229+highway_border
    554230-highway_boarder
    555231-highway_boreder
    556 +hill
    557 +historic
    558 +historic name
    559 +historical
    560 +history
    561 +Higgy:ref
    562 +hotelclass
    563 +hospital:operator
    564 +hour_off
    565 +hour_on
    566 +hours
    567 +house_numbers
    568 +iata
    569 +icao
    570 +id
    571 -ID
    572 +import_ref
    573 +incomplete
    574 +incline_steep
    575 +incline
    576 +industrial
    577 +info
    578 + info :naco
    579 +infopoint
    580 +informal_name
    581232+int_name
    582 -int name
    583233-iint_name
    584 +int_ref
    585 +interpolation
    586 +intersection
    587 +is
    588 +is_in
    589 -is in
    590 - is_in
    591 +in_in
    592 +is_in:de
    593 +is_in:es
    594234+junction
    595235-junktion
     
    600240-jounction
    601241-jumction
    602 - junction
    603242-juction
    604 -Junction
    605 -junction
    606 +junction_ref
    607 +junction:ref
    608 +junction:name
    609 +key
    610 +Kingsmede
    611 +label
    612243+landuse
    613244-land_use
     
    615246-lanudse
    616247-lanuse
    617 +lane
    618 +lanes
    619 -Lanes
    620 +last_number
    621 + Last Edit: Batchoy 2006-12-14
    622 +learning
    623 +length
    624 +level
    625 +level crossing
    626 +license
    627 +liftStation
    628 +liftType
    629 +lighthouse
    630 +line
    631 +lines
    632 +link:naming
    633 +linje
    634 +lit
    635 +loc_ref
    636 +loc_ref:fa
    637 +loc_name
    638 -loc_name
    639 +loc_name:fa
    640248+local_name
    641249-local_nama
    642 +local_ref
    643 +locality
    644 +lock
    645 +lock_gate
    646 +long_name
    647 +lorries
    648 +Loyola Heights
    649 +ma,e
    650 +main
    651 +major
    652250+man_made
    653 -man-made
    654 -man_made
    655251-mand_made
    656252-nan_made
    657253-madmade
    658254-manmade
    659 +mapkey
    660 +maplint:error
    661 +maplint:notice
    662 +maplint:warning
    663255+mapping_status
    664 -mapping status
    665256-mappingstatus
    666 +markedtrail
    667 +marker
    668 +marching_step
    669257+minspeed
    670258-min_speed
     
    672260-maspeed
    673261-max_speed
    674 -max speed
    675262-maxsepeed
    676263-maxseep
    677264-mayspeed
    678 -maxspeed
    679265-maxpeed
    680266+maxheight
     
    686272-max_wieght
    687273-maxweihgt
    688 +maxwidth
    689 +membership
    690 +memorial
    691 +menu
    692 +military
    693 +missing_street
    694 +mixed
    695 +monument
    696 +more_data
    697 +motor
    698 +motorbike
    699274+motorcar
    700275-otorcar
    701 - motorcar
    702276-motocar
    703 +motor_car
    704 +motorcars
     277-motorcars
    705278-motocars
    706279+motorcycle
    707280-motorcylce
    708281-motocycle
    709 -motorcycle
    710 +motorway
    711 +motorway station
    712 +motorway_junction
    713 +munro
    714 +museum
    715 +nad_ref
    716 +name.2
    717 +name.alt
    718 +name.en
    719 +name:ar
    720 +name:af
    721 +name:cy
    722 +name:de
    723 +name:en
    724 +name:en-cy
    725 +name:es
    726 +name:eu
    727 +name:fa
    728 +name:fi
    729 +name:fr
    730 +name:gd
    731 +name:la
    732 +name:my
    733 +name:nl
    734 +name:non
    735 +name:ru
    736 +name:sv
    737 +name.se
    738 +name.short
    739 +name:zh-Latn
    740 +name1
    741 +name2
    742 +name_alt
    743 +name int
    744 +name_int
    745 +name:source
    746 +name_source
    747 +name:cym
    748 +name_ie
    749 +name_loc
    750 +name_segment
    751 +namelayer
    752 +name:ref
    753 +name_ref
    754 +nat_name
    755 +nat_ref
    756 +nat_pref
    757 +nat_reg
    758282+natural
    759283-nataural
    760 - natural
    761284-natrual
    762285-nautral
    763 -natural
    764 +natural2
    765 +nature
    766 +navigable
    767 +ncn_name
    768 +ncn_ref
    769 +ncn:ref
    770 +ncn_route
    771 +needs_to_be
    772 +network
    773 +net_ref
    774 +newforest:pathtype
    775 +newsagent_code
    776 +nickb_marker
    777 +nickname
    778 +nlanes
    779 +noat
    780 +node
    781 +noentry
    782 +noexit
    783 - noexit
    784 +notes
    785286+note_1
    786287-note_!
    787288+note_2
    788289-note2
    789 +note_3
    790 +note_4
    791 +note_
    792 +noturn
    793 +number
    794 +numbers
    795 +obstacles
    796 +obstruction
    797 +official
    798 +ojw2
    799 +ojw_test
    800290+old_name
    801291-oldname
    802 +old_name:fa
    803 +old_full_name:fa
    804 +old_ref
    805 +opened
    806 +open_in
    807 +operator
    808 +opm:capacity
    809 +opm:difficulty
    810 +opm:liftStation
    811 +opm:liftType
    812 -opm:lifttype
    813292+osmarender:renderName
    814293-osmarender:rendername
     
    816295+osmarender:renderRef
    817296-osmrender:renderRef
    818 +owner
    819 +owners
    820 +park_and_ride
    821 +parking
    822 +parking:cost
    823 +parking:spaces
    824 +passenger
    825 +path
    826 +paved
    827 +pcv_only
    828 +pdop
    829 +pedestrian
    830 +pedestrians
    831 +permissive
    832 +petrol lhs
    833 +petrol petron
    834 +petrol
    835 +phone
    836 +phone_number
    837 +physical
    838 +place_postal
    839 +place numbers
    840 +place_code
    841 +place_name
    842 - place_name
    843 +place_numbers
    844 +place_of_worship
    845 +plave
    846 +playe
    847 +plant
    848 +poi
    849 +point_of_interest
    850 +population
    851 +popul
    852 +port
    853 +position_accuracy
    854 +possible_name
    855 +post_code
    856297+postal_code
    857 - postal_code
    858298-posatl_code
    859 +postcode
    860 +post_office
    861 +power
    862 +primary
    863299+private
    864300-privat
    865 +provided
    866 +Properties
    867 +problem
    868 +psv
    869 +public
    870 +public_transportation
    871 +punting
    872 +quality
    873 +rail
    874 +railroad
    875 +railway_tracks
    876 +ramp
    877 +recreation
    878 +recycling
    879 +recycling:batteries
    880 +recycling:bicycles
    881 +recycling:books
    882 +recycling:clothing
    883 +recycling:clothes
    884301+recycling:glas
    885302-recyling:glas
    886 +recycling:shoes
    887 +recycling:engine_oil
    888 +recycling:glass_bottles
    889 +recycling:green_waste
    890 +recycling:magazines
    891 +recycling:mobile_phones
    892 +recycling:newspaper
    893 +recycling:newspapers
    894 +recycling:printer_cartridges
    895 +recycling:cardboard
    896 +recycling:music
    897303+recycling:paper
    898304-reycling:paper
    899 +recycle:plastic_bottles
    900 +recycle:paper
    901 +recycle:magazines
    902 +recycle:cardboard
    903 +recycle:cans
    904 +recycling:cans
    905 +recycling:plastic_bottles
    906 +recycline:cardboard
    907 +recycle:glass_bottles
    908 +recycling:cork
    909 +recycling:glass
    910 +recycling:plastic
    911 +recycling:plastic_bags
    912 +recycling:plasic_bottles
    913 +recycling:scrap_metal
    914 +recycling:white_goods
    915 +recycling:wood
    916 +recycling:tyres
    917 +red
    918 +reference
    919 +ref_direction
    920 +reg
    921 +reg_name
    922 +reg_ref
    923 +reg_reg
    924 +region_id
    925305+religion
    926306-relgion
    927 +residence
    928307+residential
    929308-residentail
    930309+restriction
    931310-restrction
    932 -Restriction
    933 +restricted
    934 +restrictions
    935 -Restrictions
    936 -Restrictions
    937 +riverwidth
    938 +river_width
    939 +road
    940 +rollerblade
    941 +roundabout
    942 +route
    943 +routing
    944 +rue
    945 +runway
    946 +sat
    947 +sculpture
    948 +service
    949 +shape
    950 +sheltered
    951 +shortcut
    952 +sidewalk
    953 +sign
    954 +single_track
    955 +singletrack
    956 +shop
    957 +shopping
    958 +size
    959 +ski
    960 +slope
    961 +snowboarding
    962 +some_data
    963 +source:loc_name
    964 +source:old_name
    965 +source:old_ref
    966311+source:name
    967312-source:Name
    968 +source:ref
    969 +source_ref
    970 +source_ref:ref
    971 +source_ref:name
    972 +source:uri
    973 +source_uri
    974313+source:url
    975314-source_url
    976 +source:oneway
    977 +southglos:heritagetrail
    978 +species
    979 +speed
    980 +speed_limit
    981 +speed limit
    982 +speedlimit
    983 +speedevil
    984 +sport
    985 +sport_2
    986 +sports
    987 +stairs
    988 +start_date
    989 +state
    990 +station
    991 +stream
    992 +street
    993 +street_name
    994 +steps
    995 +structure
    996 +subtype
    997 +suburb
    998 +suggested
    999315+surface
    1000316-sruface
    1001 +surfaced
    1002 +survey_ref
    1003 +survey
    1004 - survey
    1005 +svg:font-size
    1006 +svg:stroke-width
    1007 +svg_font-size
    1008 +svg:stroke-dasharray
    1009 +swimming
    1010 +sym
    1011 +symbol
    1012 +symbolic
    1013 +tag
    1014 +taxi
    1015 +telephone
    1016 +telephone:operator
    1017 +telephone_number
    1018 +telephonenumber
    1019 +telephone_type
    1020 +test
    1021 +testing
    1022 +testnode
    1023 + this was a children's playarea with a path leading through it. Didn't want to look too dodgy :)
    1024 +the Netherlands
    1025 +NL
    1026 +thoroughfare
    1027 +time_diff
    1028 +times
    1029 +tractor
    1030 +track
    1031 +tracktype_1
    1032 +to_zip
    1033 +todo
    1034 +TODO
    1035 +toll
    1036 +tollway
    1037 +topspeed
    1038317+tourism
    1039318-tourismn
    1040319-tourim
    1041 -tourism
    1042320-toursim
    1043321-touristm
    1044 +tourist
    1045 +tourist_attraction
    1046 +towards
    1047 +town
    1048 +towpath
    1049 +tracks
    1050 +traffic
    1051 +traffic_signals
    1052 +train
    1053322+tracktype
    1054323-tractype
    1055324-tracltype
    1056325-trackype
    1057 +tram
    1058326+tramline
    1059327-tram_line
    1060 +true
    1061 +truck
    1062 +tube
    1063 +tune
    1064328+tunnel
    1065329-tunne
    1066 -tunnel
    1067 -Tunnel
    1068330-tunel
    1069331-tunnely
    1070 +turn_right
    1071 +typ
    1072332+type
    1073333-tyoe
    1074 +type.en
    1075 +uk:row
    1076 +unclassified
    1077 +upload_tag
    1078 +uploader
    1079 +uploaded_by
    1080 +uri
    1081 +url
    1082 +use
    1083 +use_status
    1084 +usage
    1085 +utility
    1086 +vdop
    1087 +vehicle
    1088 +viaduct
    1089 +vicar
    1090 +view
    1091 +village
    1092 +visited_by
    1093 +volcano
    1094 +voltage
    1095 +warning
    1096 +water
    1097 +waterfall
    1098 +wayclass
    1099 +waypoint
    1100 +web
    1101 +website
    1102 +website:official
    1103 +weight_limit
    1104 +wide
    1105 +width
    1106 +width_restriction
    1107 +wiki
    1108 +wikipedia
    1109 +wikipedia:es
    1110 +wiki:nl
    1111 +wrong
    1112 +www
    1113 +zip
    1114 +zip_code
    1115 +{}
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r13923 r14490  
    1212import java.util.Arrays;
    1313import java.util.Collection;
     14import java.util.Collections;
    1415import java.util.HashMap;
    1516import java.util.List;
     
    257258                        okValue = line.substring(1);
    258259                    } else if (line.charAt(0) == '-' && okValue != null) {
    259                         harmonizedKeys.put(harmonizeKey(line.substring(1)), okValue);
     260                        String hk = harmonizeKey(line.substring(1));
     261                        if (!okValue.equals(hk)) {
     262                            if (harmonizedKeys.put(hk, okValue) != null) {
     263                                Logging.debug(tr("Line was ignored: {0}", line));
     264                            }
     265                        }
    260266                    } else {
    261267                        Logging.error(tr("Invalid spellcheck line: {0}", line));
     
    313319
    314320    private static void addPresetValue(KeyedItem ky) {
    315         Collection<String> values = ky.getValues();
    316         if (ky.key != null && values != null) {
    317             harmonizedKeys.put(harmonizeKey(ky.key), ky.key);
     321        if (ky.key != null && ky.getValues() != null) {
     322            String hk = harmonizeKey(ky.key);
     323            if (!ky.key.equals(hk)) {
     324                harmonizedKeys.put(hk, ky.key);
     325            }
    318326        }
    319327    }
     
    415423    @Override
    416424    public void check(OsmPrimitive p) {
     425        if (!p.isTagged())
     426            return;
     427
    417428        // Just a collection to know if a primitive has been already marked with error
    418429        MultiMap<OsmPrimitive, String> withErrors = new MultiMap<>();
     
    502513                if (!isKeyInPresets(key)) {
    503514                    String prettifiedKey = harmonizeKey(key);
    504                     String fixedKey = harmonizedKeys.get(prettifiedKey);
     515                    String fixedKey = isKeyInPresets(prettifiedKey) ? prettifiedKey : harmonizedKeys.get(prettifiedKey);
    505516                    if (fixedKey != null && !"".equals(fixedKey) && !fixedKey.equals(key)) {
    506517                        // misspelled preset key
     
    525536                    String fixedValue = harmonizeValue(prop.getValue());
    526537                    Map<String, String> possibleValues = getPossibleValues(getPresetValues(key));
     538                    List<String> fixVals = new ArrayList<>();
     539                    if (!possibleValues.containsKey(fixedValue)) {
     540                        int minDist = 2;
     541                        String closest = null;
     542                        for (String possibleVal : possibleValues.keySet()) {
     543                            int dist = Utils.getLevenshteinDistance(possibleVal, fixedValue);
     544                            if (dist < minDist) {
     545                                closest = possibleVal;
     546                                minDist = dist;
     547                                fixVals.clear();
     548                                fixVals.add(possibleVal);
     549                            } else if (dist == minDist) {
     550                                fixVals.add(possibleVal);
     551                            }
     552                        }
     553                        if (minDist <= 1) {
     554                            if (fixVals.size() < 2) {
     555                                fixedValue = closest;
     556                            } else {
     557                                Collections.sort(fixVals);
     558                                // misspelled preset value with multiple good alternatives
     559                                errors.add(TestError.builder(this, Severity.WARNING, MISSPELLED_VALUE)
     560                                        .message(tr("Misspelled property value"),
     561                                                marktr("Value ''{0}'' for key ''{1}'' looks like one of {2}."), prop.getValue(), key, fixVals)
     562                                        .primitives(p)
     563                                        .build());
     564                                withErrors.put(p, "WPV");
     565                                continue;
     566                            }
     567                        }
     568                    }
    527569                    if (possibleValues.containsKey(fixedValue)) {
    528570                        final String newValue = possibleValues.get(fixedValue);
     
    596638        }
    597639
    598         checkComplex = Config.getPref().getBoolean(PREF_CHECK_COMPLEX, true);
     640        checkComplex = Config.getPref().getBoolean(PREF_CHECK_COMPLEX, true) && !checkerData.isEmpty();
    599641        if (isBeforeUpload) {
    600642            checkComplex = checkComplex && Config.getPref().getBoolean(PREF_CHECK_COMPLEX_BEFORE_UPLOAD, true);
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java

    r14273 r14490  
    101101        final List<TestError> errors = test(OsmUtils.createPrimitive("node landuse=forrest"));
    102102        assertEquals(1, errors.size());
    103         assertEquals("Presets do not contain property value", errors.get(0).getMessage());
    104         assertEquals("Value 'forrest' for key 'landuse' not in presets.", errors.get(0).getDescription());
     103        assertEquals("Misspelled property value", errors.get(0).getMessage());
     104        assertEquals("Value 'forrest' for key 'landuse' looks like 'forest'.", errors.get(0).getDescription());
     105    }
     106
     107    /**
     108     * Check for misspelled value with multiple alternatives in presets.
     109     * @throws IOException if any I/O error occurs
     110     */
     111    @Test
     112    public void testMisspelledTag2() throws IOException {
     113        final List<TestError> errors = test(OsmUtils.createPrimitive("node highway=servics"));
     114        assertEquals(1, errors.size());
     115        assertEquals("Misspelled property value", errors.get(0).getMessage());
     116        assertEquals("Value 'servics' for key 'highway' looks like one of [service, services].", errors.get(0).getDescription());
    105117    }
    106118
Note: See TracChangeset for help on using the changeset viewer.