1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/paperless-ngx_ynh.git synced 2024-09-03 19:56:33 +02:00

Add NLTK Data

This commit is contained in:
Fabian Wilkens 2023-01-11 21:13:25 +01:00
parent 16dd8fab11
commit b17ca2d229
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
4 changed files with 19 additions and 0 deletions

View file

@ -25,6 +25,7 @@ PAPERLESS_DATA_DIR=__DATADIR__/data
PAPERLESS_MEDIA_ROOT=__DATADIR__/media
#PAPERLESS_STATICDIR=../static
#PAPERLESS_FILENAME_FORMAT=
PAPERLESS_NLTK_DIR=__FINALPATH_/nltk_data
# Security and hosting

View file

@ -128,6 +128,14 @@ pushd $final_path
source "$final_path/venv/bin/activate"
ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade pip setuptools wheel
ynh_exec_as $app $final_path/venv/bin/pip3 install -r "$final_path/requirements.txt"
# Installing NLTK data
mkdir -p "$final_path/nltk_data"
chown -R "$app:" "$final_path/nltk_data"
ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" snowball_data
ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" stopwords
ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" punkt
deactivate
)
popd

View file

@ -38,6 +38,7 @@ db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
paperless_secret_key=$(ynh_app_setting_get --app=$app --key=paperless_secret_key)
ocr_language=$(ynh_app_setting_get --app=$app --key=ocr_language)
redis_db=$(ynh_redis_get_free_db)
ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db

View file

@ -124,6 +124,15 @@ pushd $final_path
source "$final_path/venv/bin/activate"
ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade pip setuptools wheel
ynh_exec_as $app $final_path/venv/bin/pip3 install -r "$final_path/requirements.txt"
# Installing NLTK data
ynh_secure_remove --file="$final_path/nltk_data"
mkdir -p "$final_path/nltk_data"
chown -R "$app:" "$final_path/nltk_data"
ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" snowball_data
ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" stopwords
ynh_exec_warn_less ynh_exec_as $app $final_path/venv/bin/python3 -m nltk.downloader -d "$final_path/nltk_data" punkt
deactivate
)
popd