sc: refer to ventral sacs overlord by its common name
[sheet.git] / tools / mkcountries-geonames
index 5128d5a9153b4c801eec8a31fb097dc0336e3d75..13f6e65d3000f3a54ff8639121b00ba3d51a1553 100755 (executable)
@@ -1,7 +1,9 @@
 #!/usr/bin/env perl
 #!/usr/bin/env perl
-use 5.012;
+use 5.014;
 use warnings;
 
 use warnings;
 
+our $VERSION = '1.04';
+
 my %cc;  # map of country code to info array
 %cc = (
        # transitional reservations
 my %cc;  # map of country code to info array
 %cc = (
        # transitional reservations
@@ -16,15 +18,16 @@ my %cc;  # map of country code to info array
        # exceptional reservations
        ac => ["exceptionally reserved: Ascension Island", "c-oc Xr", "Ascension Island", 'sh'],
        cp => ["exceptionally reserved: Clipperton Island", "c-na Xr", "Clipperton Island"],
        # exceptional reservations
        ac => ["exceptionally reserved: Ascension Island", "c-oc Xr", "Ascension Island", 'sh'],
        cp => ["exceptionally reserved: Clipperton Island", "c-na Xr", "Clipperton Island"],
+       cq => ["exceptionally reserved by gb: Island of Sark", "c-eu Xr", "Island of Sark", 'gg'],
        dg => ["exceptionally reserved: Diego Garcia", "c-as Xr", "Diego Garcia", 'io'],
        ea => ["exceptionally reserved: Ceuta and Melilla", "c-af Xr", "Ceuta and Melilla"],
        eu => ["exceptionally reserved: European Union", "c-eu Xr", "European Union"],
        dg => ["exceptionally reserved: Diego Garcia", "c-as Xr", "Diego Garcia", 'io'],
        ea => ["exceptionally reserved: Ceuta and Melilla", "c-af Xr", "Ceuta and Melilla"],
        eu => ["exceptionally reserved: European Union", "c-eu Xr", "European Union"],
-       ez => ["exceptionally reserved: European OTC derivatives", "c-eu Xr", "European OTC"],
-       fx => ["exceptionally reserved: Metropolitan France", "c-eu Xr", "Metropolitan France", 'fr'],
+       ez => ["exceptionally reserved: European OTC derivatives", "c-eu Xr", "Eurozone"],
+       fx => ["exceptionally reserved by fr: Metropolitan France", "c-eu Xr", "Metropolitan France", 'fr'],
        ic => ["exceptionally reserved: Canary Islands", "c-af Xr", "Canary Islands"],
        su => ["exceptionally reserved: former USSR", "c-eu Xr", "USSR"],
        ta => ["exceptionally reserved: Tristan da Cunha", "c-oc Xr", "Tristan da Cunha", 'sh'],
        ic => ["exceptionally reserved: Canary Islands", "c-af Xr", "Canary Islands"],
        su => ["exceptionally reserved: former USSR", "c-eu Xr", "USSR"],
        ta => ["exceptionally reserved: Tristan da Cunha", "c-oc Xr", "Tristan da Cunha", 'sh'],
-       uk => ["exceptionally reserved: United Kingdom", "c-eu Xr", "(United Kingdom)", 'gb'],
+       uk => ["exceptionally reserved by gb: United Kingdom", "c-eu Xr", "(United Kingdom)", 'gb'],
        un => ["exceptionally reserved: United Nations", "Xi Xr", "United Nations"],
 
        # indeterminate reservations
        un => ["exceptionally reserved: United Nations", "Xi Xr", "United Nations"],
 
        # indeterminate reservations
@@ -61,10 +64,20 @@ my %cc;  # map of country code to info array
        oa => ["not used: African Intellectual Property Organization", "Xi", "OAPI"], # c-af
        wo => ["not used: World Intellectual Property Organization", "Xi", "WIPO"],
 
        oa => ["not used: African Intellectual Property Organization", "Xi", "OAPI"], # c-af
        wo => ["not used: World Intellectual Property Organization", "Xi", "WIPO"],
 
-       # unicode identifiers
+       # common user-assigned
+       xa => ["user-assigned by Russia: Abkhazia", "c-az Co Xi", "Abkhazia", 'ge'], # also IC alias by CH
+       xo => ["user-assigned by Russia: South Ossetia", "c-az Co Xi", "South Ossetia", 'ge'],
+       xi => ["user-assigned for UK/EU trade: Northern Ireland", "c-eu Co Xi", "Northern Ireland", 'gb'],
+       xn => ["user-assigned by WIPO: Nordic Patent Institute", "c-eu Co Xi", "Nordic", 'dk is no se'],
+       xu => ["user-assigned by WIPO: international org UPOV", "Co Xi", "UPOV"],
+       xv => ["user-assigned by WIPO: Visegrad Patent Institute", "c-eu Co Xi", "Visegrad", 'cz hu pl sk'],
+       xx => ["user-assigned by WIPO: unknown state or other entity", "Co Xi", "other"],
+       xz => ["UN/LOCODE semantics: international waters", "Co Xi", "international"],
+       qm => ["user-assigned by ISRC: United States alternative", "c-na Co Xi", "USA"],
        qo => ["Unicode semantics: Outlying Oceania", "c-oc Co Xi", "Oceania"],
        qu => ["Unicode semantics: European Union deprecated reserve", "c-eu Co Xi", "EU", 'eu'],
        zz => ["Unicode semantics: unknown or invalid territory", "Co Xi","unknown"],
        qo => ["Unicode semantics: Outlying Oceania", "c-oc Co Xi", "Oceania"],
        qu => ["Unicode semantics: European Union deprecated reserve", "c-eu Co Xi", "EU", 'eu'],
        zz => ["Unicode semantics: unknown or invalid territory", "Co Xi","unknown"],
+       oo => ["escape to indicate additional code", "Co Xi", "escape"],
 );
 
 while (<>) {
 );
 
 while (<>) {
@@ -85,15 +98,17 @@ for (values %cc) {
                s/(?<=.)\(.*\)\s*//;
                s/ republic\b//gi;
                s/ islands?\b//gi;
                s/(?<=.)\(.*\)\s*//;
                s/ republic\b//gi;
                s/ islands?\b//gi;
-               s/\bthe //g;
+               s/\bthe //gi;
                s/ and / & /g and s/(?<=.)[a-z ]+//g;
                s/ of / /g;
                s/\bsa?int /st /gi;
                s/ and / & /g and s/(?<=.)[a-z ]+//g;
                s/ of / /g;
                s/\bsa?int /st /gi;
-               s/United /Un. /gi;
+               s/Un\Kited /. /gi;
                s/South(?:ern)? /S-/g;
                s/North(?:ern)? /N-/g;
                s/South(?:ern)? /S-/g;
                s/North(?:ern)? /N-/g;
+               s/West(?:ern)? /W-/g;
+               s/East(?:ern)? /E-/g;
                s/New /n./g;
                s/New /n./g;
-               s/(\S)(\S+)-/$1-/g;  # strip most chars preceding dash
+               s/(\w)(\w+)-/$1-/g;  # strip most chars preceding dash
                s/(\S{4}[b-df-hj-np-tv-xz])((?<!Austr)(?!land)\w{2,})/$1./g;  # abbreviate (at consonant)
                $_;
        };
                s/(\S{4}[b-df-hj-np-tv-xz])((?<!Austr)(?!land)\w{2,})/$1./g;  # abbreviate (at consonant)
                $_;
        };