feat(medcat): Add component contracting#582
Open
mart-r wants to merge 40 commits into
Open
Conversation
Collaborator
|
Could you add this into the documentation too? As you've basically already written it in the PR description which explains it well |
Collaborator
Author
I tried to figure out where to put this and went on the docs page: For this one, I'll just add some bits to the README. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds component contracting.
So far, what each component needs and provides has only been implicitly defined in the existing component behaviour. But it has not really been defined anywhere.
This PR adds such capabilities to the library. More specifically, it adds per core component type contracting. This contract isn't checked at run time, but the PR also adds simple helper methods that make verifying contracts extremely easy.
For instance, the simplest way to check that all the components (for now, only NER and linker) would be:
What the contracting tests check:
detected_namefor NER andcuifor linker)Notably, the utility method also makes a few assumption. For instance, it assumes that for the NER step
token.to_skipis called for each token (which it normally is) andner_entsare written once. And for the linker, it assumes thatner_entsare read once andlinked_entswritten once. Plus, it assumes that the output of either has at least 1 entity (otherwise collection contracting cannot be checked).Open question
Should we allow enabling this for "the first document" in production with a (defaults-to-false) config option?