Користувач:Дядько Ігор/Скрипти/Місто США
Перейти до навігації
Перейти до пошуку
#!/usr/bin/perl
$local_name = "Bar Nunn, Wyoming";
$town_name = "Бар-Нанн";
$source = `python get.py en:$local_name`;
@lines = split (/\n/, $source);
for ($n = 0; $n < @lines; $n++)
{
if ($lines[$n] =~ m/\|subdivision_name1 (.*) = \[\[(.*)\]\]/)
{
$en_state = $2;
if ($en_state eq "Wyoming")
{
$state = "Вайомінг";
$state_tmpl = "{{WY}}";
}
}
if ($lines[$n] =~ m/\|image_map (.*) = (.*)/)
{
$image_map = $2;
}
if ($lines[$n] =~ m/\|area_total_km2 (.*) = (.*)/)
{
$area_total_km2 = $2;
}
if ($lines[$n] =~ m/\|elevation_m (.*) = (.*)/)
{
$elevation_m = $2;
}
if ($lines[$n] =~ m/\|postal_code (.*) = (.*)/)
{
$postal_code = $2;
}
if ($lines[$n] =~ m/\|latd/)
{
$coord_lat = $lines[$n];
}
if ($lines[$n] =~ m/\|longd/)
{
$coord_lon = $lines[$n];
}
if ($lines[$n] =~ m/2000, there were (.*) people, (.*) households, and (.*) families residing in the town./)
{
$people = $1;
$households = $2;
$families = $3;
}
if ($lines[$n] =~ m/The \[\[population density\]\] was (.*) people per square mile (.*). There were/)
{
$density = $2;
$density =~ m/\((.*)\/(.*)/;
$density = $1;
}
if ($lines[$n] =~ m/There were (.*) housing units at an average density/)
{
$housing_units = $1;
}
if ($lines[$n] =~ m/There were (.*) households out of which (.*) had children under the age of 18 living with them/)
{
$housholds_with_children = $2;
}
if ($lines[$n] =~ m/, (.*) were \[\[Marriage\|married couples\]\] living together, (.*) had a female householder with no husband present, and (.*) were non-families./)
{
$couples = $1;
$no_husband = $2;
$no_family = $3;
}
$pattern = "s. (.*) of all households were made up of individuals and (.*) had someone living alone who was 65 years of age or older.";
if ($lines[$n] =~ m/$pattern/)
{
$above_65 = $1;
$somebody_65 = $2;
}
$pattern = "The average household size was (.*) and the average family size was (.*).";
if ($lines[$n] =~ m/$pattern/)
{
$av_household = $1;
$av_family = $2;
}
$pattern = "The median income for a household in the town was (.*), and the median income for a family was (.*). Ma";
if ($lines[$n] =~ m/$pattern/)
{
$in_household = $1;
$in_household =~ s/\,/\ \;/;
$in_household =~ s/\$//;
}
$pattern = "the median income for a family was (.*). Males";
if ($lines[$n] =~ m/$pattern/)
{
$in_family = $1;
$in_family =~ s/\,/\ \;/;
$in_family =~ s/\$//;
}
$pattern = "Males had a median income of (.*) versus";
if ($lines[$n] =~ m/$pattern/)
{
$in_male = $1;
$in_male =~ s/\,/\ \;/;
$in_male =~ s/\$//;
}
$pattern = "versus (.*) for females. The";
if ($lines[$n] =~ m/$pattern/)
{
$in_female = $1;
$in_female =~ s/\,/\ \;/;
$in_female =~ s/\$//;
}
$pattern = "The (.*) for the town was (.*)\. Abou";
if ($lines[$n] =~ m/$pattern/)
{
$in_pc = $2;
$in_pc =~ s/\,/\ \;/;
$in_pc =~ s/\$//;
}
$pattern = "About (.*) of families";
if ($lines[$n] =~ m/$pattern/)
{
$pct_fam = $1;
$pct_fam =~ s/\./\,/;
}
$pattern = "of families and (.*) of the population";
if ($lines[$n] =~ m/$pattern/)
{
$pct_pop = $1;
$pct_pop =~ s/\./\,/;
}
$pattern = "including (.*) of those under age";
if ($lines[$n] =~ m/$pattern/)
{
$pct_under = $1;
$pct_under =~ s/\./\,/;
}
$pattern = "18 and (.*) of those age 65 or over.";
if ($lines[$n] =~ m/$pattern/)
{
$pct_above = $1;
$pct_above =~ s/\./\,/;
}
}
#print $source;
print <<PAGE_END;
START
{{Infobox Settlement
|official_name = $town_name
|settlement_type = $set_type
|nickname = $nickname
|motto = $motto
|image_skyline = $image_skyline
|imagesize = 320px
|image_caption = $image_caption
|image_flag = $image_flag
|image_seal = $image_seal
|image_map = $image_map
|mapsize = 250px
|map_caption = Розтаування на мапі штату $state
|image_map1 =
|mapsize1 =
|map_caption1 =
|subdivision_type = $country
|subdivision_name = $coutry_tmpl
|subdivision_type1 = [[Штат]]
|subdivision_name1 = $state_tmpl
|subdivision_type2 = [[Округ]]
|subdivision_name2 = $county
|government_type =
|leader_title = [[Мер]]
|leader_name = $mayer
|established_title = Засноване
|established_date = $established_date
|area_magnitude =
|area_total_km2 = $area_total_km2
|area_total_sq_mi =
|area_land_km2 = $area_land_km2
|area_land_sq_mi =
|area_water_km2 = $area_water_km2
|area_water_sq_mi =
|area_water_percent = $area_water_percent
|area_urban_km2 =
|area_urban_sq_mi =
|area_metro_km2 =
|area_metro_sq_mi =
|population_as_of = [[Перепис населення у Сполучених Штатах Америки 2000 року|2000]]
|population_note =
|population_total = $people
|population_metro = $population_metro
|population_urban = $population_urban
|population_density_km2 = $density
|population_density_sq_mi =
|timezone = $timezone
|utc_offset = $utc_offset
|timezone_DST = $timezone_DST
|utc_offset_DST = -6
$coord_lat
$coord_lon
|elevation_m = $elevation_m
|elevation_ft =
|website = $website
|postal_code_type =
|postal_code = $postal_code
|area_code = $area_code
|blank_name =
|blank_info =
|blank1_name =
|blank1_info =
|footnotes =
}}
'''$town_name''' - муніципалітет у штаті [[$state]], [[США]].
== Демографія ==
За даними перепису 2000 року, на території муніципалітету мешкало $people людей,
було $households садиб та $families сімей.
[[Густота населення]] складала $density осіб/км<sup>2</sup>. Було $housing_units житлових будинків.
З $households садиб, в $housholds_with_children проживали діти до 18 років, подружніх пар, що мешкали разом, було $couples,
садиб, у яких господиня не мала чоловіка - $no_husband, садиб без сім'ї - $no_family.
Власники $above_65 садиб мали вік, що перевищував 65 років, а в $somebody_65 садиб принаймні одна людина була старшою за 65 років.
Число людей у середньому на садибу складало $av_household, а в середньому на родину $av_family.
Середній річний дохід на садибу складав $in_household\ доларів США, а на родину - $in_family\ доларів США.
Чоловіки мали дохід $in_male доларів, жінки - $in_female доларів.
Дохід на душу населення був $in_pc доларів.
Приблизно $pct_fam родин та $pct_pop населення жили за межею бідності.
Серед них осіб до 18 років було $pct_under, і понад 65 років - $pct_above.
{{US-geo-stub}}
[[Категорія:Міста Вайомінгу]]
[[en:$local_name]]
END
PAGE_END
;