Skip to content

Instantly share code, notes, and snippets.

@J535D165
Created October 26, 2022 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save J535D165/6ac038da12c041c018094ebb80ac4597 to your computer and use it in GitHub Desktop.
Save J535D165/6ac038da12c041c018094ebb80ac4597 to your computer and use it in GitHub Desktop.
Add keywords to the abstract field of a RIS file
import rispy
entries_new = []
with open('test.ris', 'r') as bibliography_file_in:
entries = rispy.load(bibliography_file_in)
for entry in entries:
entry_new = entry.copy()
if "keywords" in entry:
entry_new["abstract"] = " ⭐ ".join(entry_new["keywords"]) + "⭐ \n\n" + entry_new["abstract"]
entries_new.append(entry_new)
with open("result.ris", 'w') as bibliography_file_out:
rispy.dump(entries_new, bibliography_file_out)
@J535D165
Copy link
Author

Requires rispy (pip install rispy).

Please keep in mind that abstracts are sometimes stored in a different tag. For example, abstract_note.

@J535D165
Copy link
Author

Works with ASReview (blank lines are not supported):

Screenshot 2022-10-26 at 15 56 32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment