Skip to content

Refactor KnowledgeBase constructor#547

Merged
dakinggg merged 2 commits intoallenai:mainfrom
cthoyt:refactorlinker
Aug 29, 2025
Merged

Refactor KnowledgeBase constructor#547
dakinggg merged 2 commits intoallenai:mainfrom
cthoyt:refactorlinker

Conversation

@cthoyt
Copy link
Contributor

@cthoyt cthoyt commented Aug 17, 2025

This PR refactors the constructor of the KnowledgeBase class to extend it in two ways:

  1. Enable passing a Path object (in addition to a string)
  2. Enable passing any iterable (e.g., a list) of Entity objects

This will enable making custom KB objects, such as using Wikidata (as requested in #346) or using biomedical ontologies (as requested in #331)

This PR was originally part of #542, but that PR had too many things going on, so I split out this part to be simpler to review.

Corresponding PR in my fork (for testing purposes, because I can't run CI on the upstream): cthoyt#8

@cthoyt
Copy link
Contributor Author

cthoyt commented Aug 18, 2025

@dakinggg sorry the previous PR related to refactoring the KB class was so big - I tried to simplify it in this one.

I also added some unit tests and extra docs to test new functionality

@cthoyt
Copy link
Contributor Author

cthoyt commented Aug 26, 2025

@dakinggg thanks for the second pass. I fixed the issue with the test. This should be ready for merge now.

Co-authored-by: Daniel King <43149077+dakinggg@users.noreply.github.com>
@dakinggg dakinggg merged commit 249c805 into allenai:main Aug 29, 2025
11 checks passed
@cthoyt cthoyt deleted the refactorlinker branch August 29, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments