dbms: Removed old scripts [#MTRSADMIN-1121].

This commit is contained in:
Alexey Milovidov 2015-03-27 22:58:35 +03:00
parent b05b41a12c
commit 369a9441ee
3 changed files with 11 additions and 56 deletions

11
dbms/scripts/README Normal file
View File

@ -0,0 +1,11 @@
# How to create dictionaries for region* functions:
# 1. You need access to host ███████████.yandex-team.ru.
# 2. Do the following commands:
curl 'http://███████████.yandex-team.ru/?fields=id,parent_id,type,population' | tail -n+2 > regions_hierarchy.txt
curl 'http://███████████.yandex-team.ru/?fields=id,parent_id,type,population&new_parents=977:187' | tail -n+2 > regions_hierarchy_ua.txt
curl 'http://███████████.yandex-team.ru/?fields=id,ru_name' | tail -n+2 > regions_names_ru.txt
curl 'http://███████████.yandex-team.ru/?fields=id,uk_name' | tail -n+2 > regions_names_ua.txt
curl 'http://███████████.yandex-team.ru/?fields=id,by_name' | tail -n+2 > regions_names_by.txt
curl 'http://███████████.yandex-team.ru/?fields=id,kz_name' | tail -n+2 > regions_names_kz.txt
curl 'http://███████████.yandex-team.ru/?fields=id,tr_name' | tail -n+2 > regions_names_tr.txt

View File

@ -1,31 +0,0 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use geobase;
sub get_population {
my $key = shift;
my $depth = shift || 0;
return 0 if ($depth > 100);
my $current = int($Region{$key}->{zip_old} || 0); # zip_old, не смотря на название, содержит население региона.
return $current if ($current);
my $sum_of_children = 0;
for my $child (@{$Region{$key}->{chld}}) {
$sum_of_children += get_population($child, $depth + 1);
}
return $sum_of_children;
}
foreach my $key (keys %Region) {
print $key . "\t"
. ($Region{$key}->{parents}[-1] || 0) . "\t"
. ($Region{$key}->{type} || 0) . "\t"
. get_population($key) . "\n";
}

View File

@ -1,25 +0,0 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use geobase;
my @languages = ('ru', 'en', 'ua', 'by', 'kz', 'tr');
my @output_files = map { open(my $output, ">:encoding(UTF-8)", "regions_names_" . $_ . ".txt") || die $!; $output } @languages;
my %outputs;
@outputs{@languages} = @output_files;
foreach my $key (keys %Region) {
foreach my $lang (@languages) {
my $field = ( $lang eq 'ru' ? 'name' : $lang . '_name' );
my $name = $Region{$key}->{$field};
if ($name) {
$name =~ s/^\s+//;
$name =~ s/\s+$//;
$name =~ s/(\t|\n)/ /g;
if ($name ne '') {
print { $outputs{$lang} } $key . "\t" . $name . "\n";
}
}
}
}