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