Skip to content

Benepar model path issue #5

@dcavar

Description

@dcavar

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions