medkit.text.preprocessing.normalizer
medkit.text.preprocessing.normalizer#
Classes:
|
Generic normalizer to be used as pre-processing module |
|
Create new instance of NormalizerRule(pattern_to_replace, new_text) |
- class Normalizer(output_label, rules=None, name=None, uid=None)[source]#
Generic normalizer to be used as pre-processing module
This module is a non-destructive module allowing to replace selected characters with the wanted characters. It respects the span modification by creating a new text-bound annotation containing the span modification information from input text.
- Parameters
output_label (
str) – The output label of the created annotationsrules (
Optional[List[Tuple[str,str]]]) – The list of replacement rulesname (
Optional[str]) – Name describing the pre-processing module (defaults to the class name)uid (str) – Identifier of the pre-processing module
Methods:
run(segments)Run the module on a list of segments provided as input and returns a new list of segments
set_prov_tracer(prov_tracer)Enable provenance tracing.
Attributes:
Contains all the operation init parameters.
- run(segments)[source]#
Run the module on a list of segments provided as input and returns a new list of segments
- property description: medkit.core.operation_desc.OperationDescription#
Contains all the operation init parameters.
- Return type
- set_prov_tracer(prov_tracer)#
Enable provenance tracing.
- Parameters
prov_tracer (
ProvTracer) – The provenance tracer used to trace the provenance.
- class NormalizerRule(pattern_to_replace, new_text)[source]#
Create new instance of NormalizerRule(pattern_to_replace, new_text)
Attributes:
Alias for field number 1
Alias for field number 0
Methods:
count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
- property pattern_to_replace#
Alias for field number 0
- property new_text#
Alias for field number 1
- count(value, /)#
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)#
Return first index of value.
Raises ValueError if the value is not present.