feat(medcat): Add component contracting - #582
Conversation
|
Could you add this into the documentation too? As you've basically already written it in the PR description which explains it well |
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. |
| # MedCAT v2 | ||
|
|
||
| MedCAT v2 is now simply in at (../medcat)[./medcat]. No newline at end of file | ||
| <<<<<<< HEAD |
| } | ||
| </details> | ||
| ``` | ||
| ======= |
There was a problem hiding this comment.
Most of this file should be removed, really - it's in medcat/docs/index.md now. So did that.
| """ | ||
| return self.pipe_until(text, None) | ||
|
|
||
| def pipe_until( |
There was a problem hiding this comment.
this is nice little feature - can you add to docs / guide update when updating with comp contracting side of things?
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?