r84937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84936‎ | r84937 | r84938 >
Date:23:21, 28 March 2011
Author:rfaulk
Status:deferred
Tags:
Comment:
Taxonomy Project plug-ins, "Editor Burnouts" and "List Makers". http://meta.wikimedia.org/wiki/Contribution_Taxonomy_Project/Research_Questions
Modified paths:
  • /trunk/tools/editor_trends/analyses/plugins/burnout.py (added) (history)
  • /trunk/tools/editor_trends/analyses/plugins/list_makers.py (added) (history)

Diff [purge]

Index: trunk/tools/editor_trends/analyses/plugins/list_makers.py
@@ -0,0 +1,50 @@
 2+#!/usr/bin/python
 3+# -*- coding: utf-8 -*-
 4+'''
 5+Copyright (C) 2011 by Ryan Faulkner (rfaulkner@wikimedia.org)
 6+This program is free software; you can redistribute it and/or
 7+modify it under the terms of the GNU General Public License version 2
 8+as published by the Free Software Foundation.
 9+This program is distributed in the hope that it will be useful,
 10+but WITHOUT ANY WARRANTY; without even the implied warranty of
 11+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 12+See the GNU General Public License for more details, at
 13+http://www.fsf.org/licenses/gpl.html
 14+'''
 15+
 16+"""
 17+== List makers ==
 18+Any editor who makes more than 10 mainspace edits a month to articles with titles that begin with "List of..."
 19+"""
 20+
 21+import re # regular expression parsing
 22+
 23+
 24+__author__ = '''\n'''.join(['Diederik van Liere (dvanliere@gmail.com)', ])
 25+__email__ = 'dvanliere at gmail dot com'
 26+__date__ = '2011-01-25'
 27+__version__ = '0.1'
 28+
 29+
 30+
 31+def burnout(var, editor, **kwargs):
 32+
 33+ articles_by_year = editor['articles_by_year']
 34+
 35+ count = 0
 36+
 37+ for year in xrange(new_wikipedian.year, var.max_year):
 38+ for month in xrange(1, 13):
 39+ for article in articles_by_year[year][month]:
 40+ """ locate article titles containing "List of" """
 41+ if re.search('List of', article):
 42+ count = count + 1
 43+
 44+
 45+ """ Add all editors with an edit count of more than 10 """
 46+
 47+ if count > 10:
 48+ var.add(editor['username'], 1)
 49+
 50+
 51+ return var
Index: trunk/tools/editor_trends/analyses/plugins/burnout.py
@@ -0,0 +1,41 @@
 2+#!/usr/bin/python
 3+# -*- coding: utf-8 -*-
 4+'''
 5+Copyright (C) 2011 by Ryan Faulkner (rfaulkner@wikimedia.org)
 6+This program is free software; you can redistribute it and/or
 7+modify it under the terms of the GNU General Public License version 2
 8+as published by the Free Software Foundation.
 9+This program is distributed in the hope that it will be useful,
 10+but WITHOUT ANY WARRANTY; without even the implied warranty of
 11+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 12+See the GNU General Public License for more details, at
 13+http://www.fsf.org/licenses/gpl.html
 14+'''
 15+
 16+__author__ = '''\n'''.join(['Diederik van Liere (dvanliere@gmail.com)', ])
 17+__email__ = 'dvanliere at gmail dot com'
 18+__date__ = '2011-01-25'
 19+__version__ = '0.1'
 20+
 21+
 22+
 23+def burnout(var, editor, **kwargs):
 24+ new_wikipedian = editor['new_wikipedian']
 25+ edits = editor['monthly_edits']
 26+
 27+ burnout = False
 28+ sum =0.0
 29+ count = 0.0
 30+
 31+ for year in xrange(new_wikipedian.year, var.max_year):
 32+ for month in xrange(1, 13):
 33+ if edits[year][month] > 249:
 34+ burnout = True
 35+ if burnout == True:
 36+ sum += edits[year][month]
 37+ count +=1.0
 38+
 39+ if sum / count < 10 and burnout == True:
 40+ var.add(editor['username'], 1)
 41+
 42+ return var