spaCy - Util.set_data_path



This function is used to set custom path to the data directory, where spaCy looks for models.

Argument

The table below explains its argument −

NAME TYPE DESCRIPTION
Path unicode/Path It will be the path to the new data directory where spacy looks for models.

Example

An example for util.set_data_path() function is as follows −

import spacy
spacy.util.set_data_path(r"C:\Users\Leekha\Anaconda3\pkgs")
spacy.util.get_data_path()

Output

WindowsPath('C:/Users/Leekha/Anaconda3/pkgs')

You can see from the above output it has changed the path to the path we have provided.

spacy_util_get_data_path.htm
Advertisements