forked from Rakshitha03/DBLP_processing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
populate_reviewerInfo.py
202 lines (193 loc) · 8.97 KB
/
populate_reviewerInfo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
from time import sleep
import openreview
import dblp
import inspect
import json
import os
# reviewersInfo = {}
# initializing openreview_client to post notes.
username = 'OpenReview.net' #fill in your email address that you use to log in to OpenReview
password = '1234567890' #fill in your password
baseurl = 'http://localhost:3000' #fill in your desired baseurl (e.g. 'http://localhost:3000', or 'http://dev.openreview.net', etc.)
openreview_client = openreview.Client(username=username, password=password, baseurl=baseurl)
# reading the reviewer info from csv file and obtaining information about the user
fp = open("./iclr_accepted_reviewers.csv")
no_name = 0
more_than_one = 0
no_hits = 0
no_match = 0
no_pub = 0
author_disambiguation = {}
no_hits_names = []
no_name_list = []
no_matched_author = []
no_pub_list = []
notes_count = 0
for eachLine in fp.readlines():
emailId, firstName, lastName = eachLine.split(',')
name = firstName + " " + lastName.strip()
file_name = firstName + "_" + lastName.strip()
if name == '' or name == ' ':
print emailId
no_name += 1
no_name_list.append(emailId)
else:
try:
authors = dblp.search(name)
except Exception as e:
sleep(2)
authors = dblp.search(name)
if authors:
if len(authors) > 1:
print "More than one authors found! "
more_than_one += 1
author_disambiguation[name] = []
author = None
for ath in authors:
author_disambiguation[name].append(ath.name)
if name.lower() == ath.name.lower():
author = ath
# print name + ' : ' + unicode(author.name).encode('utf-8')
if not author:
no_matched_author.append(name)
print "No perfect match found for: ", name
print author_disambiguation[name]
no_match += 1
if author and len(author.publications) == 0:
print "No publications found for ", name
no_pub += 1
no_pub_list.append(name)
continue
if author and len(author.publications) > 0:
print len(author.publications)
publications_set = set()
for publication in author.publications:
try:
pub_title = publication.title
except Exception as e:
sleep(2)
pub_title = publication.title
if pub_title in publications_set:
continue
note = openreview.Note()
publications_set.add(pub_title)
ath_ids = []
for ath_name in publication.authors:
if ath_name.lower() == author.name.lower():
ath_ids.append(emailId)
else:
ath_ids.append('_')
note.content = {
'abstract': '',
'school': publication.school ,
'publisher':publication.publisher ,
'chapter': publication.chapter,
'crossref': publication.crossref,
'pages': publication.pages,
'volume': publication.volume,
'journal': publication.journal,
'type': publication.type,
'sub_type': publication.sub_type,
'editors': ','.join(publication.editors),
'booktitle': publication.booktitle,
'year': publication.year,
'month': publication.month,
'mag_number': publication.number,
'series': publication.series,
'ee': publication.ee,
'isbn': publication.isbn,
'DBLP_url': 'publication.url',
'authorids': ath_ids,
'authors': publication.authors,
'title': publication.title,
}
note.invitation = 'DBLP.org/-/paper'
note.signatures = ['DBLP.org/upload']
note.writers = note.signatures
note.readers = ['everyone']
note.cdate = 1234
note.to_json()
try:
openreview_client.post_note(note)
notes_count += 1
except Exception as e:
print "EXCEPTION !!", e
# for title in publications_set:
# title = unicode(title).encode('utf-8')
else:
author = authors[0]
if len(author.publications) == 0:
print "No publications found for ", name
no_pub += 1
no_pub_list.append(name)
if len(author.publications) > 0:
print len(author.publications)
publications_set = set()
for publication in author.publications:
try:
pub_title = publication.title
except Exception as e:
sleep(2)
pub_title = publication.title
if pub_title in publications_set:
continue
note = openreview.Note()
publications_set.add(pub_title)
ath_ids = []
for ath_name in publication.authors:
if ath_name.lower() == author.name.lower():
ath_ids.append(emailId)
else:
ath_ids.append('_')
note.content = {
'abstract': '',
'school': publication.school,
'publisher': publication.publisher,
'chapter': publication.chapter,
'crossref': publication.crossref,
'pages': publication.pages,
'volume': publication.volume,
'journal': publication.journal,
'type': publication.type,
'sub_type': publication.sub_type,
'editors': ','.join(publication.editors),
'booktitle': publication.booktitle,
'year': publication.year,
'month': publication.month,
'mag_number': publication.number,
'series': publication.series,
'ee': publication.ee,
'isbn': publication.isbn,
'DBLP_url': 'publication.url',
'authorids': ath_ids,
'authors': publication.authors,
'title': publication.title,
}
note.invitation = 'DBLP.org/-/paper'
note.signatures = ['DBLP.org/upload']
note.writers = note.signatures
note.readers = ['everyone']
note.cdate = 1234
note.to_json()
try:
openreview_client.post_note(note)
notes_count += 1
except Exception as e:
print "EXCEPTION !!", e
# for title in publications_set:
# title = unicode(title).encode('utf-8')
else:
print "No hit in dblp for ", name
no_hits_names.append(name)
no_hits += 1
print "Stats: "
print "No names for: ", no_name
print "No names list: ", no_name_list
print "More than 1 author hits for ", more_than_one
print "No hits for ", no_hits
print "No hit list: ", no_hits_names
print "No matches count ", no_match
print "No matches list", no_matched_author
print "No publications: ", no_pub
print "No publications list: ", no_pub_list
print "No. of notes created are: ", notes_count