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, force=False)[source]#
Downloads and install a specified DaCy pipeline.
- Parameters
model (str) – string indicating DaCy model, use dacy.models() to get a list of models.
force (bool) – Should it download the model regardless of it already being present? Defaults to False.
- Returns
a string of the model location
- Return type
str
Example
>>> download_model(model="da_dacy_medium_trf-0.1.0")
- dacy.download.get_latest_version(model)[source]#
Returns the latest version of a DaCy model.
- Parameters
model (str) – string indicating the model
- Returns
latest version of the model
- Return type
str
dacy.load#
Functionality for loading and locating DaCy models.
- dacy.load.load(model, force=False, **kwargs)[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()
force (bool) – Should the model be redownloaded even if already downloaded? Default to False.
kwargs (Any) – additional arguments passed to spacy.load()
- 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()[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=True)[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()