Skip to content

Commit

Permalink
citation count by id script: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanhb committed Dec 12, 2023
1 parent a8a4b6e commit 39fea66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions scripts/calc_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def calc_stats(dump_path=None):
write = csv.writer(f)
write.writerow(["omid","citations"])
for id in cited_entities:
id = id.replace("omid:","")
write.writerow([id,cited_entities[id]])

str_stats = "#entites = "+str(len(all_entities)) + "\n"
Expand Down
9 changes: 5 additions & 4 deletions scripts/citation_count_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
if len(row) == 2:
for any_id in row[1].split(" "):
if any_id.startswith(args.id):
omid_map[row[0]] = any_id
omid = row[0].replace("omid:","")
omid_map[omid] = any_id


citation_count_by_id = dict()
Expand All @@ -25,9 +26,9 @@
reader = csv.reader(input_csvfile)
for row in reader:
if len(row) == 2:

if row[0] in omid_map:
any_id = omid_map[row[0]]
omid = row[0]
if omid in omid_map:
any_id = omid_map[omid]
citation_count_by_id[any_id] = row[1]

with open(args.out, mode='w', newline='') as output_csvfile:
Expand Down

0 comments on commit 39fea66

Please sign in to comment.