git.fiddlerwoaroof.com
commenters.py
46aa7e6c
 import sys
 import collections
 data = []
 collect = []
 for line in sys.stdin:
     if '\xc2\xb7' in line:
         if collect:
             data.append(collect)
         collect = []
     else:
         line = line.strip()
         if line: collect.append(line)
 
 commentors = collections.defaultdict(int)
 for chunk in data:
     line = chunk[0].split()
     name_end = 1
     while name_end < len(line) and (line[name_end].endswith('.') or len(line[name_end]) < 4):
         name_end += 1
     name = line[:name_end+1]
     if len(name) > 2 and name[1] == 'HF': name = name[:2]
     commentors[' '.join(name)] += 1
 
 for x,y in commentors.iteritems():
     print "%s\t%s" % (x,y)