Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benepar model path issue #5

Open
dcavar opened this issue Apr 30, 2023 · 0 comments
Open

Benepar model path issue #5

dcavar opened this issue Apr 30, 2023 · 0 comments

Comments

@dcavar
Copy link

dcavar commented Apr 30, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant