X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/49069763e748ef46dcb2587647a6f5c26bf04214..d96b16650836046f79dc76641681445f97bd60ce:/tools/mkcountries-geonames diff --git a/tools/mkcountries-geonames b/tools/mkcountries-geonames index 0eaf880..d9b938a 100755 --- a/tools/mkcountries-geonames +++ b/tools/mkcountries-geonames @@ -11,6 +11,23 @@ while (<>) { $cc{ lc $iso } = [ $name, $class ]; } +for (values %cc) { + for ($_->[2] //= $_->[0]) { + s/,.*//; + s/(?<=.)\(.*\)\s*//; + s/ republic\b//gi; + s/ islands?\b//gi; + s/\bthe //g; + s/ and / & /g and s/(?<=.)[a-z ]+//g; + s/\bsaint /st /gi; + s/South(?:ern)? /S-/g; + s/North(?:ern)? /N-/g; + s/New /n./g; + s/(\S)(\S+)-/$1-/g; # strip most chars preceding dash + s/(\S{4}[b-df-hj-np-tv-xz])((?