Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alecjacobson/b36c4dba356ed39581c91dc465cf90e5 to your computer and use it in GitHub Desktop.
Save alecjacobson/b36c4dba356ed39581c91dc465cf90e5 to your computer and use it in GitHub Desktop.
Frequency Count of Papers Most Cited in a Specific Authors Publications
#!/usr/bin/env python
from semanticscholar import SemanticScholar
from collections import defaultdict
sch = SemanticScholar(timeout=2)
# Replace with author id found in url like
# https://www.semanticscholar.org/author/E.-Catmull/3132499
author = sch.author(3132499)
paperId_counts = defaultdict(int)
paperId_short_recs = {}
for authors_paper_short_rec in author['papers']:
print(authors_paper_short_rec['title'])
authors_paper_full_rec = sch.paper(authors_paper_short_rec['paperId'])
for referenced_paper_short_rec in authors_paper_full_rec['references']:
paperId_counts[referenced_paper_short_rec['paperId']] += 1
paperId_short_recs[referenced_paper_short_rec['paperId']] = referenced_paper_short_rec
paperId_counts_sorted = {k: v for k, v in sorted(paperId_counts.items(), key=lambda item: -item[1])}
for paperId, count in paperId_counts_sorted.items():
rec = paperId_short_recs[paperId]
print(f'{count}\t"{rec["title"]}," {rec["year"]}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment