[openaddresses] fix Chinese house number validation
This commit is contained in:
@@ -789,10 +789,7 @@ countries:
|
||||
- filename: wuhan.csv
|
||||
add_osm_boundaries: true
|
||||
fields:
|
||||
NUMBER:
|
||||
component: house_number
|
||||
STREET:
|
||||
component: road
|
||||
<<: *default_fields
|
||||
DISTIRCT:
|
||||
component: city_district
|
||||
cz:
|
||||
|
||||
@@ -150,7 +150,10 @@ class OpenAddressesFormatter(object):
|
||||
if not house_number:
|
||||
return False
|
||||
tokens = tokenize(house_number)
|
||||
return all((c in token_types.NUMERIC_TOKEN_TYPES or t in (u'号', u'栋', u'附')) for t, c in tokens)
|
||||
|
||||
if all((c in token_types.NUMERIC_TOKEN_TYPES or t in (u'号', u'栋', u'附')) for t, c in tokens):
|
||||
return True
|
||||
return cls.validate_house_number(house_number)
|
||||
|
||||
component_validators = {
|
||||
AddressFormatter.HOUSE_NUMBER: validators.validate_house_number,
|
||||
@@ -158,7 +161,6 @@ class OpenAddressesFormatter(object):
|
||||
AddressFormatter.POSTCODE: validators.validate_postcode,
|
||||
}
|
||||
|
||||
|
||||
language_validators = {
|
||||
SPANISH: {
|
||||
AddressFormatter.HOUSE_NUMBER: validators.validate_house_number_sin_numero,
|
||||
|
||||
Reference in New Issue
Block a user