dalejn / cleanBib

Probabilistically assign gender and race proportions of first/last authors pairs in bibliography entries
MIT License
149 stars 31 forks source link

Key error in the code #50

Closed micaela349 closed 1 year ago

micaela349 commented 1 year ago

Hello! I was trying to run the code but I get an error that I can't solve by myself: KeyError Traceback (most recent call last) Cell In [6], line 17 15 bib_data = get_duplicates(bib_data, bib_files[0]) 16 # get names, remove CDS, find self cites ---> 17 get_names(homedir, bib_data, yourFirstAuthor, yourLastAuthor, optionalEqualContributors, cr) 19 bib_check(homedir)

File ~/utils/preprocessing.py:331, in get_names(homedir, bib_data, yourFirstAuthor, yourLastAuthor, optionalEqualContributors, cr) 313 for key in bib_data.entries.keys(): 314 diversity_bib_titles = ['The extent and drivers of gender imbalance in neuroscience reference lists', 315 'The gender citation gap in international relations', 316 'Gendered citation patterns in international relations journals', (...) 329 'Name-ethnicity classification from open sources', 330 'Predicting race and ethnicity from the sequence of characters in a name'] --> 331 if bib_data.entries[key].fields['title'] in diversity_bib_titles: 332 continue 334 try:

File /srv/conda/envs/notebook/lib/python3.10/site-packages/pybtex/utils.py:163, in CaseInsensitiveDict.getitem(self, key) 162 def getitem(self, key): --> 163 return self._dict[key.lower()]

KeyError: 'title'

It is getting this error for these references: } @incollection{sutter-a, citation-number = {39.}, author = {Sutter, Raoul and Hert, L. and Marchis, G.M. and Kuhle,Jens}, language = {en}, booktitle = {Serum Neurofilament Light Chain Levels in the Intensive Care Unit: Comparison between Severely Ill Patients with and without Coronavirus Disease 2019}, volume = {89}, doi = {10.1002/ana.26004}, date = {2021}, pages = {610–616}, journal = {Ann Neurol}, number = {3}

} @incollection{leppert-a, citation-number = {47.}, author = {Leppert, David and Kropshofer, H. and Häring, D.A.A. and Kuhle,Jens}, language = {en}, booktitle = {Blood Neurofilament Light in Progressive Multiple Sclerosis: Post Hoc Analysis of 2 Randomized Controlled Trials}, volume = {2022}, doi = {10.1212/WNL.0000000000200258}, journal = {Neurology. April}, number = {10}

Could you help me please?