-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb57e36
commit fd28c61
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#! /usr/bin/env python | ||
# this script computes the extended comminity size per year | ||
import sys | ||
|
||
buf = 1000000 | ||
|
||
names = {} | ||
po = open('rdf/partOf.curated.txt','r') | ||
for line in po.readlines(): | ||
x,r,y = line.strip().split('"')[1:4] | ||
if r == ' partOf ' and y == "MoDELS": | ||
names[x] = [] | ||
po.close() | ||
|
||
pa = open('rdf/publishedAt.txt','r') | ||
tmplines = pa.readlines(buf) | ||
while tmplines: | ||
for line in tmplines: | ||
x,r,y = line.strip().split('"')[1:4] | ||
if r == ' publishedAt ': | ||
if y in names.keys(): | ||
if x not in names[y]: | ||
names[y].append(x) | ||
tmplines = pa.readlines(buf) | ||
pa.close() | ||
|
||
years = {} | ||
for n in names.keys(): | ||
y = n.replace('/','').replace('-','') | ||
for x in range(ord('a'),ord('z')+1): | ||
y = y.replace(chr(x),'') | ||
y = int(y[0:4]) | ||
if y not in years: | ||
years[y] = [] | ||
for name in names[n]: | ||
if name not in years[y]: | ||
years[y].append(name) | ||
|
||
extyears = {} | ||
for y in years.keys(): | ||
extyears[y] = years[y][:] | ||
|
||
cw = open('rdf/collabWith.txt','r') | ||
tmplines = cw.readlines(buf) | ||
while tmplines: | ||
for line in tmplines: | ||
x,r,y = line.strip().split('"')[1:4] | ||
if r == ' collaboratedWith ': | ||
for yr in years.keys(): | ||
if x in years[yr]: | ||
if y not in extyears[yr]: | ||
extyears[yr].append(y) | ||
tmplines = cw.readlines(buf) | ||
cw.close() | ||
|
||
for y in sorted(years.keys()): | ||
print y,' ',len(extyears[y]) |