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
5c4796f
commit e4b62a8
Showing
1 changed file
with
35 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,35 @@ | ||
#! /usr/bin/env python | ||
import sys | ||
|
||
buf = 300000 | ||
|
||
# reverse author-of | ||
rao = {} | ||
|
||
ao = open('../cache/authorOf.rdf','r') | ||
tmplines = ao.readlines(buf) | ||
cx = 1 | ||
while tmplines: | ||
for line in tmplines: | ||
c = line.split('"') | ||
if c[3] not in rao.keys(): | ||
rao[c[3]] = [] | ||
rao[c[3]].append(c[1]) | ||
print 'Processed', cx*buf, 'lines...' | ||
tmplines = ao.readlines(buf) | ||
cx += 1 | ||
ao.close() | ||
|
||
print 'AuthorOf read!' | ||
|
||
ps = open('pi.all','r') | ||
ass = open('ai2.all','w') | ||
for line in ps.readlines(): | ||
paper = line.strip() | ||
if paper in rao.keys(): | ||
for a in rao[paper]: | ||
ass.write('%s\n' % a) | ||
else: | ||
print 'Unknown paper:',paper | ||
ps.close() | ||
ass.close() |