pii.custom_nlp_engine#

Module Contents#

Classes#

Data#

API#

class pii.custom_nlp_engine.CustomNlpEngine(
models: list[dict[str, str]] | None = None,
ner_model_configuration: presidio_analyzer.nlp_engine.NerModelConfiguration | None = None,
)#

Bases: presidio_analyzer.nlp_engine.SpacyNlpEngine

Initialization

load() None#

Load the spaCy NLP model.

process_batch(
texts: list[str] | list[tuple[str, object]],
language: str,
as_tuples: bool = False,
batch_size: int = 32,
) collections.abc.Iterator[presidio_analyzer.nlp_engine.NlpArtifacts | None]#

Execute the NLP pipeline on a batch of texts using spacy pipe.

Parameters:
  • texts – A list of texts to process.

  • language – The language of the texts.

  • as_tuples – If set to True, inputs should be a sequence of (text, context) tuples. Output will then be a sequence of (doc, context) tuples. Defaults to False.

  • batch_size – The batch size.

pii.custom_nlp_engine.logger#

‘getLogger(…)’