medspacy.postprocess.postprocessing_pattern
PostprocessingPattern
PostprocessingPatterns are callable functions and equality values wrapped together that will create triggers in the later Postprocessor as part of PostprocessingRules.
Source code in medspacy/postprocess/postprocessing_pattern.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
__call__(ent)
Call the PostprocessingPattern on the span specified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ent
|
Span
|
the span to process. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether calling |
Source code in medspacy/postprocess/postprocessing_pattern.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
__init__(condition, success_value=True, **kwargs)
A PostprocessingPattern defines a single condition to check against an entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
condition
|
Callable
|
A function to call on an entity. If the result of the function call equals success_value, then the pattern passes. |
required |
success_value
|
Any
|
The value which should be returned by condition(ent) in order for the pattern to pass. Must have == defined for condition(ent) == success_value. |
True
|
kwargs
|
Optional keyword arguments to call with condition(ent, **kwargs). |
{}
|
Source code in medspacy/postprocess/postprocessing_pattern.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |