As an anonymous user, you can only add new data. If you would like to also modify existing data, please create an account and indicate your languages on your user page.

User:Kipcool/stats/compte lang.pl

From OmegaWiki
Jump to: navigation, search
#!/usr/bin/perl

$listeexp = "liste_exp.txt" ;

$nomlang[0] = "0" ;
$nomlang[1] = "1" ;
$nomlang[2] = "2" ;
$nomlang[3] = "3" ;
$nomlang[4] = "4" ;
$nomlang[5] = "5" ;
$nomlang[6] = "6" ;
$nomlang[7] = "7" ;
$nomlang[8] = "8" ;
$nomlang[9] = "9" ;
$nomlang[10] = "10" ;
$nomlang[11] = "11" ;
$nomlang[12] = "12" ;
$nomlang[13] = "13" ;
$nomlang[14] = "14" ;
$nomlang[15] = "15" ;
$nomlang[16] = "16" ;
$nomlang[17] = "17" ;
$nomlang[18] = "18" ;
$nomlang[19] = "19" ;
$nomlang[20] = "20" ;
$nomlang[21] = "21" ;
$nomlang[22] = "22" ;
$nomlang[23] = "23" ;
$nomlang[24] = "24" ;
$nomlang[25] = "25" ;
$nomlang[26] = "26" ;
$nomlang[27] = "27" ;
$nomlang[28] = "28" ;
$nomlang[29] = "29" ;
$nomlang[30] = "30" ;
$nomlang[31] = "31" ;
$nomlang[32] = "32" ;
$nomlang[33] = "33" ;
$nomlang[34] = "34" ;
$nomlang[35] = "35" ;
$nomlang[36] = "36" ;
$nomlang[37] = "37" ;
$nomlang[38] = "38" ;
$nomlang[39] = "39" ;
$nomlang[40] = "40" ;
$nomlang[41] = "41" ;
$nomlang[42] = "42" ;
$nomlang[43] = "43" ;
$nomlang[44] = "44" ;
$nomlang[45] = "45" ;
$nomlang[46] = "46" ;
$nomlang[47] = "47" ;
$nomlang[48] = "48" ;
$nomlang[49] = "49" ;
$nomlang[50] = "50" ;
$nomlang[51] = "51" ;
$nomlang[52] = "52" ;
$nomlang[53] = "53" ;
$nomlang[54] = "54" ;
$nomlang[55] = "55" ;
$nomlang[56] = "56" ;
$nomlang[57] = "57" ;
$nomlang[58] = "58" ;
$nomlang[59] = "59" ;
$nomlang[60] = "60" ;
$nomlang[61] = "61" ;
$nomlang[62] = "62" ;
$nomlang[63] = "63" ;
$nomlang[64] = "64" ;
$nomlang[65] = "65" ;
$nomlang[66] = "66" ;
$nomlang[67] = "67" ;
$nomlang[68] = "68" ;
$nomlang[69] = "69" ;
$nomlang[70] = "70" ;
$nomlang[71] = "71" ;
$nomlang[72] = "72" ;
$nomlang[73] = "73" ;
$nomlang[74] = "74" ;
$nomlang[75] = "75" ;
$nomlang[76] = "76" ;
$nomlang[77] = "77" ;
$nomlang[78] = "78" ;
$nomlang[79] = "79" ;
$nomlang[80] = "80" ;
$nomlang[81] = "81" ;
$nomlang[82] = "82" ;
$nomlang[83] = "83" ;
$nomlang[84] = "Bulgarian" ;
$nomlang[85] = "English" ;
$nomlang[86] = "French" ;
$nomlang[87] = "Spanish" ;
$nomlang[88] = "Russian" ;
$nomlang[89] = "Dutch" ;
$nomlang[90] = "Czech" ;
$nomlang[91] = "Swedish" ;
$nomlang[92] = "Slovenian" ;
$nomlang[93] = "Polish" ;
$nomlang[94] = "Portuguese" ;
$nomlang[95] = "Bokmâl" ;
$nomlang[96] = "Basque" ;
$nomlang[97] = "Slovak" ;
$nomlang[98] = "Estonian" ;
$nomlang[99] = "Finnish" ;
$nomlang[100] = "Italian" ;
$nomlang[101] = "German" ;
$nomlang[102] = "Hungarian" ;
$nomlang[103] = "Danish" ;
$nomlang[104] = "English (USA)" ;
$nomlang[105] = "Greek" ;
$nomlang[106] = "Hebrew" ;
$nomlang[107] = "Mandarin (simplified)" ;
$nomlang[108] = "108" ;
$nomlang[109] = "Neapolitan" ;
$nomlang[110] = "Marathi" ;
$nomlang[111] = "Lombard" ;
$nomlang[112] = "Japanese" ;
$nomlang[113] = "Esperanto" ;
$nomlang[114] = "Piedmontese" ;
$nomlang[115] = "Venetian" ;
$nomlang[116] = "Ukrainian" ;
$nomlang[117] = "Catalan" ;
$nomlang[118] = "Ewe" ;
$nomlang[119] = "Akan" ;
$nomlang[120] = "Arabic" ;
$nomlang[121] = "Hausa (Arabic script)" ;
$nomlang[122] = "Hausa (Latin script)" ;
$nomlang[123] = "Armenian" ;
$nomlang[124] = "Georgian" ;
$nomlang[125] = "Afrikaans" ;
$nomlang[126] = "French (Canada)" ;
$nomlang[127] = "French (Switzerland)" ;
$nomlang[128] = "Serbian (Cyrillic script)" ;
$nomlang[129] = "Serbian (Latin script)" ;
$nomlang[130] = "Thai" ;
$nomlang[131] = "Ido" ;
$nomlang[132] = "132" ;
$nomlang[133] = "Romanian" ;
$nomlang[134] = "Kölsch" ;
$nomlang[135] = "Mandarin (traditional)" ;
$nomlang[136] = "English (United Kingdom)" ;
$nomlang[137] = "Turk" ;
$nomlang[138] = "Korean" ;
$nomlang[139] = "Khmer" ;
$nomlang[140] = "Sicilian" ;
$nomlang[141] = "Aragonese" ;
$nomlang[142] = "Persian" ;
$nomlang[143] = "Latvian" ;
$nomlang[144] = "Vietnamese" ;
$nomlang[145] = "Swahili" ;
$nomlang[146] = "Bavarian" ;
$nomlang[147] = "Belarusian" ;
$nomlang[148] = "Kashubian" ;
$nomlang[149] = "Croatian" ;
$nomlang[150] = "Lithuanian" ;
$nomlang[151] = "Cantonese" ;
$nomlang[152] = "Tadjik" ;
$nomlang[153] = "Welsh" ;
$nomlang[154] = "Bambara" ;
$nomlang[155] = "Portuguese (Brazil)" ;
$nomlang[156] = "Portuguese (Portugal)" ;
$nomlang[157] = "Lingala (Latin)" ;
$nomlang[158] = "Telugu" ;
$nomlang[159] = "Gilaki" ;
$nomlang[160] = "Eastern Mari" ;
$nomlang[161] = "Western Mari" ;
$nomlang[162] = "Gujarati" ;
$nomlang[163] = "Hindi" ;
$nomlang[164] = "Tamil" ;
$nomlang[165] = "Indonesian" ;
$nomlang[166] = "Irish" ;
$nomlang[167] = "French (Belgium)" ;
$nomlang[168] = "Limburgish" ;
$nomlang[169] = "Alemannic German" ;
$nomlang[170] = "Marwari" ;
$nomlang[171] = "Sranan" ;
$nomlang[172] = "German (Austria)" ;
$nomlang[173] = "German (Switzerland)" ;
$nomlang[174] = "Greek (ancient)" ;
$nomlang[175] = "Greek (Mycenaean)" ;
$nomlang[176] = "Greek (Cappadocian)" ;
$nomlang[177] = "Tosk" ;
$nomlang[178] = "Gheg" ;
$nomlang[179] = "Arvanitic" ;
$nomlang[180] = "Arbëreshë Albanian" ;
$nomlang[181] = "Kannada" ;
$nomlang[182] = "Breton" ;
$nomlang[183] = "Frisia" ;
$nomlang[184] = "Navajo" ;
$nomlang[185] = "bengalese" ;
$nomlang[186] = "Urdu" ;
$nomlang[187] = "French (France)" ;
$nomlang[188] = "Nepali" ;
$nomlang[189] = "Igbo" ;
$nomlang[190] = "Ladin" ;
$nomlang[191] = "Kazakh" ;
$nomlang[192] = "Waals" ;
$nomlang[193] = "Icelandic" ;
$nomlang[194] = "Tatar" ;
$nomlang[195] = "Asturian" ;
$nomlang[196] = "Sindhi (Arabic script)" ;
$nomlang[197] = "Sindhi (Gurumukhi script)" ;
$nomlang[198] = "Yoruba" ;
$nomlang[199] = "Galician" ;
$nomlang[200] = "Nynorsk" ;
$nomlang[201] = "Kashubian" ;
$nomlang[202] = "Lingala" ;
$nomlang[203] = "Bahasa Xhosa" ;
$nomlang[204] = "Upper Sorbian" ;
$nomlang[205] = "Lower Sorbian" ;
$nomlang[206] = "Tagalog" ;
$nomlang[207] = "Maltese" ;
$nomlang[208] = "Cebuano" ;
$nomlang[209] = "Macedonian" ;
$nomlang[210] = "Interlingua" ;
$nomlang[211] = "Interlingue" ;
$nomlang[212] = "Bavarian" ;
$nomlang[213] = "Faroese" ;
$nomlang[214] = "Zulu" ;
$nomlang[215] = "Sanskrit" ;
$nomlang[216] = "Nepal Bhasa" ;
$nomlang[217] = "Malayalam" ;
$nomlang[218] = "Flemish" ;
$nomlang[219] = "Chickasaw" ;
$nomlang[220] = "Corsican" ;
$nomlang[221] = "Volapuk" ;
$nomlang[222] = "Malay" ;
$nomlang[223] = "Kabyle" ;
$nomlang[224] = "Manaweg" ;
$nomlang[225] = "Ossetian" ;
$nomlang[226] = "Crimean Tatar" ;
$nomlang[227] = "Bashkir" ;
$nomlang[228] = "Cherokee" ;
$nomlang[229] = "Kyrgyz" ;
$nomlang[230] = "Kiribati" ;
$nomlang[231] = "Javanese" ;
$nomlang[232] = "Extremaduran" ;
$nomlang[233] = "Tetum" ;
$nomlang[234] = "Mirandese" ;
$nomlang[235] = "Emiliano-Romagnolo" ;
$nomlang[236] = "Wolof" ;
$nomlang[237] = "Somali" ;
$nomlang[238] = "Latin" ;
$nomlang[239] = "Novial" ;
$nomlang[240] = "Eastern Yiddish" ;
$nomlang[241] = "Pitjantjatjara" ;
$nomlang[242] = "Lojban" ;
$nomlang[243] = "Luxembourgish" ;
$nomlang[244] = "Romansch" ;
$nomlang[245] = "Mingrelian" ;
$nomlang[246] = "Maori" ;
$nomlang[247] = "Karakalpak" ;
$nomlang[248] = "Maldivian" ;
$nomlang[249] = "Assamese" ;
$nomlang[250] = "Abkhaz" ;
$nomlang[251] = "Kotava" ;
$nomlang[252] = "Sundanese" ;
$nomlang[253] = "Cornish" ;
$nomlang[254] = "Pennsylvania Deitsch" ;
$nomlang[255] = "Comorian" ;
$nomlang[256] = "Saterfries" ;
$nomlang[257] = "Luganda" ;
$nomlang[258] = "Sinhala" ;
$nomlang[259] = "Bishnupriya" ;
$nomlang[260] = "Central Kurdish" ;
$nomlang[261] = "Tigrigna" ;
$nomlang[262] = "Scottish Gaelic" ;
$nomlang[263] = "Old English" ;
$nomlang[264] = "Dzongkha" ;
$nomlang[265] = "Lingua Franca Nova" ;
$nomlang[266] = "Nhengatu" ;
$nomlang[267] = "Silesian" ;
$nomlang[268] = "Megleno Romanian" ;
$nomlang[269] = "Ingush" ;
$nomlang[270] = "Southern Balochi" ;
$nomlang[271] = "Erzya" ;
$nomlang[272] = "Lao" ;
$nomlang[273] = "Occitan" ;
$nomlang[274] = "Ligurian" ;
$nomlang[275] = "Burmese" ;
$nomlang[276] = "Amharic" ;
$nomlang[277] = "Moksha" ;
$nomlang[278] = "Ilokano" ;
$nomlang[279] = "Chuvash" ;
$nomlang[280] = "Samoan" ;
$nomlang[281] = "Udmurt" ;
$nomlang[282] = "Tok Pisin" ;
$nomlang[283] = "Franco-Provencal" ;
$nomlang[284] = "Scots" ;
$nomlang[285] = "Wymysorys" ;
$nomlang[286] = "Hawaiian" ;
$nomlang[287] = "Chechen" ;
$nomlang[288] = "Bosnian" ;
$nomlang[289] = "Tongan" ;
$nomlang[290] = "Bakhtiari" ;
$nomlang[291] = "Pontic" ;
$nomlang[292] = "Egyptian Arabic" ;
$nomlang[293] = "Picard" ;
$nomlang[294] = "South Saami" ;
$nomlang[295] = "Vero" ;
$nomlang[296] = "K'iche'" ;
$nomlang[297] = "Tabasco Chontal" ;
$nomlang[298] = "Chol" ;
$nomlang[299] = "Ch'orti'" ;
$nomlang[300] = "Tzeltal" ;
$nomlang[301] = "Tzotzil" ;
$nomlang[302] = "Chicomuceltec" ;
$nomlang[303] = "Huastec" ;
$nomlang[304] = "Chuj" ;
$nomlang[305] = "Tojolabal" ;
$nomlang[306] = "Jakalteko" ;
$nomlang[307] = "Kanjobal" ;
$nomlang[308] = "Akateko" ;
$nomlang[309] = "Mocho" ;
$nomlang[310] = "Awakateko" ;
$nomlang[311] = "Ixil" ;
$nomlang[312] = "Mam" ;
$nomlang[313] = "Tektiteko" ;
$nomlang[314] = "Kekchi'" ;
$nomlang[315] = "Poqomam" ;
$nomlang[316] = "Poqomchi'" ;
$nomlang[317] = "Kaqchikel" ;
$nomlang[318] = "Achi" ;
$nomlang[319] = "Tz'utujil" ;
$nomlang[320] = "Sacapulteco" ;
$nomlang[321] = "Sipacapense" ;
$nomlang[322] = "Uspanteco" ;
$nomlang[323] = "Mopan Maya" ;
$nomlang[324] = "Lacandon" ;
$nomlang[325] = "Yucatan Maya" ;
$nomlang[326] = "326" ;
$nomlang[327] = "327" ;
$nomlang[328] = "328" ;
$nomlang[329] = "329" ;
$nomlang[330] = "330" ;
$nomlang[331] = "331" ;
$nomlang[332] = "332" ;
$nomlang[333] = "333" ;
$nomlang[334] = "334" ;
$nomlang[335] = "335" ;
$nomlang[336] = "336" ;
$nomlang[337] = "337" ;
$nomlang[338] = "338" ;
$nomlang[339] = "339" ;


for ( $i = 0 ; $i < 249 ; $i++ ) {
  $langcount[$i] = 0 ;
}

open(LISTEEXP, $listeexp) ;

while(<LISTEEXP>){
  if ( $_ =~ m/\s+(\d+)$/ ) {
    $langcount[$1]++ ;
    # print "$1\n" ;
  }
}

$owdatabase = "omegawiki" ;

## on exclu 0, il y a un bug
for ( $i = 1 ; $i < 309 ; $i++ )
{
  if ( $langcount[$i] > 0 ) {
    $langhash{$nomlang[$i]} = $langcount[$i] ;
    # print "$nomlang[$i] : $langcount[$i]\n" ;
    $nbexp_total += $langcount[$i] ;

    # compter nb DM par langue
    $query = "USE $owdatabase\nSELECT DISTINCT uw_syntrans.defined_meaning_id\nFROM uw_syntrans, uw_expression\nWHERE uw_syntrans.remove_transaction_id IS NULL AND uw_expression.remove_transaction_id IS NULL AND uw_syntrans.expression_id = uw_expression.expression_id AND uw_expression.language_id = $i ;" ;

#    print "-- $query\n" ;
    $nbdm = `echo "$query" | mysql -u root | wc -l` ;
    chop($nbdm) ;
    $dmhash{$nomlang[$i]} = $nbdm ;
    $nbdm_total += $nbdm ;

    # compter nb DM avec def traduite dans langue
    $query = "USE $owdatabase\nSELECT uw_translated_content.translated_content_id\nFROM uw_translated_content\nWHERE uw_translated_content.remove_transaction_id IS NULL AND uw_translated_content.language_id = $i ;" ;

#    print "-- $query\n" ;
    $nbdm_def = `echo "$query" | mysql -u root | wc -l` ;
    chop($nbdm_def) ;
    $dm_defhash{$nomlang[$i]} = $nbdm_def ;

    $nbdm_def_total += $nbdm_def ;
  }
}

# print "nb exp total : $nbexp_total\n" ;
$color = "#FFFFFF" ;

print "{|class=sortable\n" ;
print "|-\n" ;
print "! Language\n" ;
print "! # Expression\n" ;
print "! # DM with exp\n" ;
print "! # DM with def\n" ;

# print "|-\n" ;
# print "| bgcolor = \"$color\" | Total || bgcolor = \"$color\" |  $nbexp_total || bgcolor = \"$color\" |  $nbdm_total || bgcolor = \"$color\" |  $nbdm_def_total\n" ;

foreach $toto ( sort { $dmhash{$b} <=> $dmhash{$a} } (keys %langhash) ) {
#  print "$toto : $langhash{$toto}\n" ;

  print "|-\n" ;
  print "| bgcolor = \"$color\" | $toto || bgcolor = \"$color\" |  $langhash{$toto} || bgcolor = \"$color\" |  $dmhash{$toto} || bgcolor = \"$color\" |  $dm_defhash{$toto}\n" ;

  if ( $color eq "#FFFFFF" ) { $color = "#EEEEEE" ; } else { $color = "#FFFFFF" ; }
}

print "|}\n" ;