mindmeld.text_preparation.spacy_model_factory module

This module contains a Spacy Model Factory.

class mindmeld.text_preparation.spacy_model_factory.SpacyModelFactory[source]

Bases: object

Spacy (Language) Model Factory Class

static get_spacy_language_model(language, spacy_model_size='lg', disable=())[source]

Get a Spacy Language model.

Parameters:
  • language (str, optional) -- Language as specified using a 639-1/2 code.
  • spacy_model_name (str) -- Name of the Spacy NER model (Ex: "en_core_web_sm")
  • disable (Iterable[str]) -- Tuple of pipeline elements to disable. ('ner', 'tagger', 'parser', etc.)
Returns:

Spacy language model. (Ex: "spacy.lang.es.Spanish")

Return type:

nlp

static validate_spacy_language(language)[source]

Check if the language is valid.

Parameters:language (str, optional) -- Language as specified using a 639-1/2 code.
static validate_spacy_model_size(spacy_model_size)[source]

Check if the model size is valid.

Parameters:spacy_model_size (str, optional) -- Size of the Spacy model to use. ("sm", "md", or "lg")