You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default and hard-coded path should be made a variable or search the home-directory first. It triggers an error if the folder does not exist:
# Create the nltk_data path if it does not exist. In this path the benepar models will be saved.
nltk_data_dir = Path(sys.exec_prefix, "share", "nltk_data")
if not Path.exists(nltk_data_dir):
nltk_data_dir.mkdir(parents=True, exist_ok=True)
A way out would be to use the NLTK internal variable and check for all paths:
import nltk
print(nltk.data.path)
This is a list of paths (strings).
We could add a path to it:
nltk.data.path.append("/home/me/nltk_data/")
and the download of the benepar models, for example, should go into the one that the user has read/write permissions on.
Right now, the error with download_models=True gives you the following:
The default and hard-coded path should be made a variable or search the home-directory first. It triggers an error if the folder does not exist:
# Create the nltk_data path if it does not exist. In this path the benepar models will be saved.
nltk_data_dir = Path(sys.exec_prefix, "share", "nltk_data")
if not Path.exists(nltk_data_dir):
nltk_data_dir.mkdir(parents=True, exist_ok=True)
A way out would be to use the NLTK internal variable and check for all paths:
import nltk
print(nltk.data.path)
This is a list of paths (strings).
We could add a path to it:
nltk.data.path.append("/home/me/nltk_data/")
and the download of the benepar models, for example, should go into the one that the user has read/write permissions on.
Right now, the error with download_models=True gives you the following:
PermissionError: [Errno 13] Permission denied: '/usr/share/nltk_data'
on common Linux platforms.
The text was updated successfully, but these errors were encountered: