From 14f08e59910310e1e0a48167d30d0b24a55b5061 Mon Sep 17 00:00:00 2001 From: Al Date: Wed, 1 Jun 2016 17:12:35 -0400 Subject: [PATCH] [formatting] Adding aliases in formatting config, so e.g. most of the Francophone world shares France's config without needing to be the case for every French address (e.g. Belgium), generic config for continental Europe, etc. --- resources/addresses/nl.yaml | 2 + resources/formatting/global.yaml | 361 +++++++++++++++++++------------ 2 files changed, 224 insertions(+), 139 deletions(-) diff --git a/resources/addresses/nl.yaml b/resources/addresses/nl.yaml index 06a00e61..1c4927a5 100644 --- a/resources/addresses/nl.yaml +++ b/resources/addresses/nl.yaml @@ -1,3 +1,5 @@ +# nl.yaml +# ------- # Note: base config covers Dutch as spoken in the Netherlands # Belgium overrides go in country configs diff --git a/resources/formatting/global.yaml b/resources/formatting/global.yaml index 04a79966..275aa2a5 100644 --- a/resources/formatting/global.yaml +++ b/resources/formatting/global.yaml @@ -82,137 +82,8 @@ global: # Overrides for languages (better for e.g. covering all French-speaking countries) languages: - en: - insertions: - building: - building_after_house: - after: house - probability: 0.6 - building_after_road: - after: road - probability: 0.3 - building_before_suburb: - before: suburb - probability: 0.1 - conditional: - - component: subdivision - probabilities: - building_after_house: - after: house - probability: 0.6 - building_after_road: - after: road - probability: 0.2 - building_before_subdivision: - before: subdivision - probability: 0.2 - entrance: - # e.g. 123 East 45th St, 6th Floor, NYC - entrance_after_road: - after: road - probability: 0.75 - entrance_before_house: - before: house - probability: 0.1 - # e.g. Da Vinci House, 1st Floor, 44 Saffron Hill, London - entrance_before_house_number: - before: house_number - probability: 0.15 - conditional: - - component: building - probabilities: - # default: 0.8 - entrance_after_building: - after: building - probability: 0.2 - - - staircase: - # e.g. 123 East 45th St, Staircase C, NYC - staircase_after_road: - after: road - probability: 0.5 - # e.g. Floor 1, Da Vinci House, 44 Saffron Hill, London - staircase_before_house: - before: house - probability: 0.1 - # e.g. Da Vinci House, 1st Floor, 44 Saffron Hill, London - staircase_before_house_number: - before: house_number - probability: 0.4 - conditional: - - component: entrance - probabilities: - # default: 0.1 - staircase_after_entrance: - after: entrance - probability: 0.9 - - level: - # e.g. 123 East 45th St, 6th Floor, NYC - level_after_road: - after: road - probability: 0.5 - # e.g. Floor 1, Da Vinci House, 44 Saffron Hill, London - level_before_house: - before: house - probability: 0.25 - # e.g. Da Vinci House, 1st Floor, 44 Saffron Hill, London - level_before_house_number: - before: house_number - probability: 0.25 - - conditional: - - component: staircase - probabilities: - # default: 0.4 - level_after_staircase: - after: staircase - probability: 0.6 - - component: entrance - probabilities: - # default: 0.4 - level_after_entrance: - after: entrance - probability: 0.6 - - unit: - # e.g. Flat 18, Da Vinci House, 44 Saffron Hill, London - unit_before_house: - before: house - probability: 0.2 - - # e.g. Da Vinci House, Flat 18, 44 Saffron Hill, London - unit_before_house_number: - before: house_number - probability: 0.6 - - # e.g. Da Vinci House, 44 Saffron Hill, Flat 18, London (not as common in UK) - unit_after_road: - after: road - probability: 0.2 - - conditional: - - component: level - probabilities: - unit_before_house: - before: house - probability: 0.1 - # e.g. Da Vinci House, Flat 18, 44 Saffron Hill, London - unit_before_house_number: - before: house_number - probability: 0.1 - # e.g. Floor 5, Apt 6 - unit_after_level: - after: level - probability: 0.79 - # e.g. Apt. 6, 5/F (less common) - unit_before_level: - before: level - probability: 0.01 - - es: - insertions: + continental_european_languages: + insertions: &continental_european_template_insertions building: building_after_house_number: after: house_number @@ -234,7 +105,7 @@ languages: probability: 0.2 entrance: - # e.g. 123 East 45th St, 6th Floor, NYC + # e.g. Calle Foo 3, entrada 1 entrance_after_house_number: after: house_number probability: 0.8 @@ -346,15 +217,142 @@ languages: after: building probability: 0.9 + en: + insertions: &english_template_insertions + building: + building_after_house: + after: house + probability: 0.6 + building_after_road: + after: road + probability: 0.3 + building_before_suburb: + before: suburb + probability: 0.1 + conditional: + - component: subdivision + probabilities: + building_after_house: + after: house + probability: 0.6 + building_after_road: + after: road + probability: 0.2 + building_before_subdivision: + before: subdivision + probability: 0.2 + entrance: + # e.g. 123 East 45th St, 6th Floor, NYC + entrance_after_road: + after: road + probability: 0.75 + entrance_before_house: + before: house + probability: 0.1 + # e.g. Da Vinci House, 1st Floor, 44 Saffron Hill, London + entrance_before_house_number: + before: house_number + probability: 0.15 + conditional: + - component: building + probabilities: + # default: 0.8 + entrance_after_building: + after: building + probability: 0.2 - fr: - # libpostal issue #27 - insertions: - city: - city_before_road: - before: road - probability: 0.001 + staircase: + # e.g. 123 East 45th St, Staircase C, NYC + staircase_after_road: + after: road + probability: 0.5 + # e.g. Floor 1, Da Vinci House, 44 Saffron Hill, London + staircase_before_house: + before: house + probability: 0.1 + # e.g. Da Vinci House, 1st Floor, 44 Saffron Hill, London + staircase_before_house_number: + before: house_number + probability: 0.4 + conditional: + - component: entrance + probabilities: + # default: 0.1 + staircase_after_entrance: + after: entrance + probability: 0.9 + level: + # e.g. 123 East 45th St, 6th Floor, NYC + level_after_road: + after: road + probability: 0.5 + # e.g. Floor 1, Da Vinci House, 44 Saffron Hill, London + level_before_house: + before: house + probability: 0.25 + # e.g. Da Vinci House, 1st Floor, 44 Saffron Hill, London + level_before_house_number: + before: house_number + probability: 0.25 + + conditional: + - component: staircase + probabilities: + # default: 0.4 + level_after_staircase: + after: staircase + probability: 0.6 + - component: entrance + probabilities: + # default: 0.4 + level_after_entrance: + after: entrance + probability: 0.6 + + unit: + # e.g. Flat 18, Da Vinci House, 44 Saffron Hill, London + unit_before_house: + before: house + probability: 0.2 + + # e.g. Da Vinci House, Flat 18, 44 Saffron Hill, London + unit_before_house_number: + before: house_number + probability: 0.6 + + # e.g. Da Vinci House, 44 Saffron Hill, Flat 18, London (not as common in UK) + unit_after_road: + after: road + probability: 0.2 + + conditional: + - component: level + probabilities: + unit_before_house: + before: house + probability: 0.1 + # e.g. Da Vinci House, Flat 18, 44 Saffron Hill, London + unit_before_house_number: + before: house_number + probability: 0.1 + # e.g. Floor 5, Apt 6 + unit_after_level: + after: level + probability: 0.79 + # e.g. Apt. 6, 5/F (less common) + unit_before_level: + before: level + probability: 0.01 + + es: + insertions: *continental_european_template_insertions + + de: + insertions: *continental_european_template_insertions + + nl: + insertions: *continental_european_template_insertions countries: # Hungary, e.g. 1075, Budapest Kazinczy utca 14 @@ -420,3 +418,88 @@ countries: before: level probability: 0.01 + fr: + insertions: &france_template_insertions + <<: *english_template_insertions + level: + level_after_road: + after: road + probability: 0.95 + level_before_house: + before: house + probability: 0.01 + level_before_house_number: + before: house_number + probability: 0.04 + + conditional: + - component: staircase + probabilities: + level_after_staircase: + after: staircase + probability: 0.95 + - component: entrance + probabilities: + # default: 0.4 + level_after_entrance: + after: entrance + probability: 0.95 + + unit: + unit_before_house: + before: house + probability: 0.02 + + # e.g. Da Vinci House, Flat 18, 44 Saffron Hill, London + unit_before_house_number: + before: house_number + probability: 0.03 + + # e.g. Da Vinci House, 44 Saffron Hill, Flat 18, London (not as common in UK) + unit_after_road: + after: road + probability: 0.95 + + conditional: + - component: level + probabilities: + unit_before_house: + before: house + probability: 0.005 + # e.g. Da Vinci House, Flat 18, 44 Saffron Hill, London + unit_before_house_number: + before: house_number + probability: 0.01 + # e.g. Floor 5, Apt 6 + unit_after_level: + after: level + probability: 0.98 + # e.g. Apt. 6, 5/F (less common) + unit_before_level: + before: level + probability: 0.005 + # libpostal issue #27 + city: + city_before_road: + before: road + probability: 0.001 + + # Algeria + dz_fr: + insertions: *france_template_insertions + + # Luxembourg + lu_fr: + insertions: *france_template_insertions + + # Monaco + mc: + insertions: *france_template_insertions + + # Senegal + sn: + insertions: *france_template_insertions + + # Tunisia + tn_fr: + insertions: *france_template_insertions \ No newline at end of file