def force(): print '** Wrote' idP = dict() idA = dict() for line in gp: splitted = line.split(",") idP[splitted[1]] = splitted[0] for line in ga: splitted = line.split(",") splitted[1] = splitted[1][1:-1] idA[splitted[1]] = splitted[0] print "idP = " + str(len(idP)) print "idA = " + str(len(idA)) gw = gzip.GzipFile(wrote, 'w') for p, paper in enumerate(jsonDBLP.papers()): tag, title, authors, year = paper tags = tag.split("/") if (tags[0] == 'journals') and (tags[1] in [ "tog", "tvcg", "cgf", "cga", "vc", "cad", "cagd" ]): for auth in authors: auth = auth.encode("utf-8") gw.write(str(idA[auth])) gw.write(",") gw.write(str(idP[tag])) gw.write("\n") gw.close()
def force (): print '** Wrote' idP = dict() idJ = dict() for line in gp: splitted = line.split(",") idP[ splitted[1] ] = splitted[0] for line in gj: splitted = line.split(",") splitted[1] = splitted[1][ 1 : - 1] idJ[ splitted[1] ] = splitted[0] print "idP = " + str(len(idP)) print "idJ = " + str(len(idJ)) # TODO UPDATE gw = gzip.GzipFile (publish, 'w') for p, paper in enumerate (jsonDBLP.papers ()): tag, title, authors, year = paper tags = tag.split("/") if (tags[0] == 'journals') and (tags[1] in ["tog", "tvcg", "cgf", "cga", "vc", "cad", "cagd"]): journal = tags[1] gw.write( str( idJ[journal] ) ) gw.write( "," ) gw.write( str( idP[tag] ) ) gw.write( "\n") gw.close()
def force(): idx = 0 for p, paper in enumerate(jsonDBLP.papers()): tag, title, authors, year, doi = paper tags = tag.split("/") title = title.encode("utf-8").replace('"', "'") if (tags[0] == 'journals') and (tags[1] in [ "tog", "tvcg", "cgf", "cga", "vc", "cad", "cagd" ]): doi = doi[doi.rfind("/", 0, doi.rfind("/")) + 1:] print str(idx) + " " + base_url + doi idx = idx + 1
def force (): print '** Papers' idx = 0 out = gzip.GzipFile ('data/papers.csv.gz', 'w') for p, paper in enumerate (jsonDBLP.papers ()): tag, title, authors, year, doi = paper tags = tag.split("/") title = title.encode("utf-8") if (tags[0] == 'journals') and (tags[1] in ["tog", "tvcg", "cgf", "cga", "vc", "cad", "cagd"]): out.write( str(idx) + ",") out.write( tag + ",") title = title.replace('"',"'") out.write( "\"" + title + "\"" + ",") out.write( str(year) + ",") out.write( doi + "\n") idx = idx+1
def force(): print '** Computing coauthorship half-square graph...' idP = dict() idA = dict() for line in gp: splitted = line.split(",") idP[splitted[1]] = splitted[0] for line in ga: splitted = line.split(",") splitted[1] = splitted[1][1:-1] idA[splitted[1]] = splitted[0] print "idP = " + str(len(idP)) print "idA = " + str(len(idA)) out = gzip.GzipFile('data/coauthorship.csv.gz', 'w') edgecount = 0 for p, paper in enumerate(jsonDBLP.papers()): tag, title, authors, year = paper tags = tag.split("/") if (tags[0] == 'journals') and (tags[1] in [ "tog", "tvcg", "cgf", "cga", "vc", "cad", "cagd" ]): for i in range(0, len(authors)): for j in range(0, len(authors)): if i == j: continue auth1 = authors[i].encode("utf-8") auth2 = authors[j].encode("utf-8") idA1 = idA[auth1] idA2 = idA[auth2] idP1 = idP[tag] out.write(str(idA1) + ",") out.write(str(idA2) + ",") out.write(str(idP1) + "\n") out.close()
def force(): print '** Journals' confs = set() idx = 0 out = gzip.GzipFile('data/journals.csv.gz', 'w') for p, paper in enumerate(jsonDBLP.papers()): tag, title, authors, year = paper tags = tag.split("/") if (tags[0] == 'journals') and (tags[1] in [ "tog", "tvcg", "cgf", "cga", "vc", "cad", "cagd" ]): confs.add(tags[1]) for conf in sorted(confs): conf = conf.encode("utf-8") out.write(str(idx) + ",") out.write("\"" + conf + "\"" + ",") out.write("\"\"" + "\n") idx = idx + 1 out.close()
def force(): print '** Authors' auths = set() idx = 0 out = gzip.GzipFile('data/authors.csv.gz', 'w') for p, paper in enumerate(jsonDBLP.papers()): tag, title, authors, year = paper tags = tag.split("/") if (tags[0] == 'journals') and (tags[1] in [ "tog", "tvcg", "cgf", "cga", "vc", "cad", "cagd" ]): for auth in authors: auths.add(auth) for auth in sorted(auths): auth = auth.encode("utf-8") out.write(str(idx) + ",") out.write("\"" + auth + "\"" + ",") out.write("\"\"" + ",") out.write("\"\"" + "\n") idx = idx + 1