# spaCy Tasks


This module contains a collection of tasks for interacting with the spaCy library.

# SpacyNLP

class

prefect.tasks.spacy.spacy_tasks.SpacyNLP

(text="", nlp=None, spacy_model_name="en_core_web_sm", disable=None, component_cfg=None, exclude=None, **kwargs)[source]

Task for processing text with a spaCy pipeline.

Args:

  • text (unicode, optional): string to be processed, can be provided during construction or when task is run
  • nlp (spaCy text processing pipeline, optional): a custom spaCy text processing pipeline, if provided, this pipeline will be used instead of being created from spacy_model_name
  • spacy_model_name (str, optional): name of the spaCy language model, default model is 'en_core_web_sm', will be ignored if nlp is provided
  • disable (List[str], optional): list of pipeline components to disable, only applicable to pipelines loaded from spacy_model_name
  • exclude (List[str], optional): Names of pipeline components to exclude. Excluded components won’t be loaded. (Only applicable in spacy >= 3.0)
  • component_cfg (dict, optional): a dictionary with extra keyword arguments for specific components, only applicable to pipelines loaded from spacy_model_name
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.spacy.spacy_tasks.SpacyNLP.run

(text="")[source]

Task run method. Creates a spaCy document.

Args:

  • text (unicode, optional): text to be processed
Returns:
  • Doc: spaCy document



# SpacyTagger

class

prefect.tasks.spacy.spacy_tasks.SpacyTagger

(nlp=None, **kwargs)[source]

Task for returning tagger from a spaCy pipeline.

Args:

  • nlp (spaCy text processing pipeline, optional): a custom spaCy text processing pipeline
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.spacy.spacy_tasks.SpacyTagger.run

(nlp=None)[source]

Task run method. Returns tagger component of spaCy pipeline.

Args:

  • nlp (spaCy text processing pipeline, optional): a custom spaCy text processing pipeline, must be provided if not specified in construction
Returns:
  • Tagger: spaCy Tagger object



# SpacyParser

class

prefect.tasks.spacy.spacy_tasks.SpacyParser

(nlp=None, **kwargs)[source]

Task for returning parser from a spaCy pipeline.

Args:

  • nlp (spaCy text processing pipeline, optional): a custom spaCy text processing pipeline
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.spacy.spacy_tasks.SpacyParser.run

(nlp=None)[source]

Task run method. Returns parser component of spaCy pipeline.

Args:

  • nlp (spaCy text processing pipeline, optional): a custom spaCy text processing pipeline, must be provided if not specified in construction
Returns:
  • Parser: spaCy Parser object



# SpacyNER

class

prefect.tasks.spacy.spacy_tasks.SpacyNER

(nlp=None, **kwargs)[source]

Task for returning named entity recognizer from a spaCy pipeline.

Args:

  • nlp (spaCy text processing pipeline, optional): a custom spaCy text processing pipeline
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.spacy.spacy_tasks.SpacyNER.run

(nlp=None)[source]

Task run method. Returns named entity recognition component of spaCy pipeline.

Args:

  • nlp (spaCy text processing pipeline, optional): a custom spaCy text processing pipeline, must be provided if not specified in construction
Returns:
  • NER: spaCy NER object



# SpacyComponent

class

prefect.tasks.spacy.spacy_tasks.SpacyComponent

(component_name="", nlp=None, **kwargs)[source]

Task for returning named component from a spaCy pipeline.

Args:

  • component_name (str, optional): name of spaCy pipeline component to return, must be provided during construction or run time
  • nlp (spaCy text processing pipeline, optional): a custom spaCy text processing pipeline
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.spacy.spacy_tasks.SpacyComponent.run

(component_name, nlp=None)[source]

Task run method. Returns named component of spaCy pipeline.

Args:

  • component_name (str, optional): name of spaCy pipeline component to return, must be provided during construction or run time
  • nlp (spaCy text processing pipeline, optional): a custom spaCy text processing pipeline, must be provided if not specified in construction
Returns:
  • Component: spaCy pipeline component object



This documentation was auto-generated from commit bd9182e
on July 31, 2024 at 18:02 UTC