ebooksgratis.com

See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
User:RussBlau/dplcount.py - Wikipedia, the free encyclopedia

User:RussBlau/dplcount.py

From Wikipedia, the free encyclopedia

Following is a Python script to count the progress of link-fixing on WP:DPL. This script requires the Pywikipedia framework.

For those not familiar with Python, please be aware that indentation is significant. You can copy-and-paste this text into a plain text file on your local machine, but do not change any of the white space unless you know what you are doing.

Note that the current disambiguation dump page location is hard-coded into the script; this will need to be updated, where indicated, whenever a new dump is started.

# script to count progress on [[WP:DPL]]

import re
import wikipedia

try:
    site = wikipedia.getSite()
# Edit the following line whenever a new dump is posted
    dplpage = wikipedia.Page(site, "Wikipedia:Disambiguation pages with links/2006-07-17 dump")
    text = dplpage.get()
    todomark = text.index("===To do===")
    donemark = text.index("===Done===")
    counter = re.compile(r": ([0-9]+) ?(?:</s>)? ?\[\[Special:Whatlinkshere/")
    todocount = 0
    todolinks = 0
    donecount = 0
    donelinks = 0

    for match in counter.finditer(text, todomark, donemark):
        todocount += 1
        if not int(match.group(1)):
            print "Check formatting:"
            print text[match.start()-40, match.end()+40]
        todolinks += int(match.group(1))

    for match in counter.finditer(text, donemark):
        donecount += 1
        if not int(match.group(1)):
            print "Check formatting:"
            print text[match.start()-40, match.end()+40]
        donelinks += int(match.group(1))

    print "Found %i articles, %i links to do; %i articles, %i links done." % (
        todocount, todolinks, donecount, donelinks)

    print "Progress: %i out of %i links (%.1f%%)" % (
        donelinks, donelinks + todolinks,
        100.0 * donelinks / (donelinks + todolinks))
        
finally:
    wikipedia.stopme()
    


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -