Downloading and Loading#

These include methods for downloading DaCy models and loading them into memory.

dacy.download#

Functions for downloading DaCy models.

dacy.download.download_model(model: str, save_path: Optional[str] = None, force: bool = False, verbose: bool = True) str[source]#

Downloads and install a specified DaCy pipeline.

Parameters
  • model (str) – string indicating DaCy model, use dacy.models() to get a list of models

  • save_path (str, optional) – The path you want to save your model to. Is only used for DaCy models of v0.0.0 as later models are installed as modules to allow for better versioning. Defaults to None denoting the default cache directory. This can be found using using dacy.where_is_my_dacy().

  • force (bool, optional) – Should it download the model regardless of it already being present? Defaults to False.

  • verbose (bool) – Toggles the verbosity of the function. Defaults to True.

Returns

a string of the model location

Example

>>> download_model(model="da_dacy_medium_tft-0.0.0")
dacy.download.install(package)[source]#
dacy.download.models() list[source]#

Returns a list of valid DaCy models

Returns

list of valid DaCy models

Return type

list

dacy.load#

Functionality for loading and locating DaCy models.

dacy.load.load(model: str, path: Optional[str] = None, force_download: bool = False) spacy.language.Language[source]#

Load a DaCy model as a SpaCy text processing pipeline. If the model is not downloaded it will also download the model.

Parameters
  • model (str) – the model you wish to load. To see available model see dacy.models()

  • path (str, optional) – The path to the downloaded model. Defaults to None which corresponds to the path optained using dacy.where_is_my_dacy().

  • force_redownload (bool, optional) – Should the model be redownloaded even if already downloaded? Default to False.

Returns

a SpaCy text-preprocessing pipeline

Return type

Language

Example

>>> import dacy
>>> dacy.load("da_dacy_medium_trf-0.1.0")
>>> # or equivalently
>>> dacy.load("medium")
dacy.load.models() list[source]#

Returns a list of valid DaCy models

Returns

list of valid DaCy models

Return type

list

Example

>>> import dacy
>>> dacy.models()
dacy.load.where_is_my_dacy(verbose: bool = True) str[source]#

Returns a path to where DaCy models are located. The default the model location can be configured with the environmental variable DACY_CACHE_DIR.

Parameters

verbose (bool, optional) – Toggles the verbosity of the function. Defaults to True.

Returns

path to the location of DaCy models

Return type

str

Example

>>> import dacy
>>> dacy.where_is_my_dacy()