alessandro trinca tornidor
commited on
Commit
·
a90cae8
1
Parent(s):
d93f88f
feat: add option to easily download nltk data files
Browse files- scripts/install.sh +12 -0
scripts/install.sh
CHANGED
|
@@ -20,6 +20,7 @@ display_help() {
|
|
| 20 |
echo 'Usage: install.sh <option>'
|
| 21 |
echo 'Options:'
|
| 22 |
echo ' -h --help Show help'
|
|
|
|
| 23 |
echo ' -i --only-install Only install the python package and its dependencies (optional, without this option the script will install the package and run it)'
|
| 24 |
echo " -p --python-executable <python_executable> Specifies the python executable to use (optional, without this option the default python3 executable (${python_executable}) will be used)"
|
| 25 |
echo " -o --allowed-origin <allowed_origin> Specifies the allowed origin for the webserver (optional, without this option the default value (${ALLOWED_ORIGIN}) will be used)"
|
|
@@ -63,6 +64,11 @@ case $key in
|
|
| 63 |
only_install=YES
|
| 64 |
shift # past argument
|
| 65 |
;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
*) echo "Unknown parameter passed: '$1'";
|
| 67 |
display_help
|
| 68 |
exit 1
|
|
@@ -103,6 +109,12 @@ installer(){
|
|
| 103 |
# gitlab prefix: https://gitlab.com/{GITLAB_USER}/{GITLAB_REPO}/-/raw
|
| 104 |
URL_REPOSITORY_PREFIX="https://raw.githubusercontent.com/${GITHUB_USER}/${GITHUB_REPO}/refs/tags/${MGW_VERSION}"
|
| 105 |
python -m pip install my-ghost-writer -r "${URL_REPOSITORY_PREFIX}/requirements-webserver.txt"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
echo -e "\n# installed my-ghost-writer version: ${MGW_VERSION}!"
|
| 107 |
}
|
| 108 |
|
|
|
|
| 20 |
echo 'Usage: install.sh <option>'
|
| 21 |
echo 'Options:'
|
| 22 |
echo ' -h --help Show help'
|
| 23 |
+
echo ' -d --download-nltk Download required NLTK data files (crubadan, optional since you could download them manually or have them already)'
|
| 24 |
echo ' -i --only-install Only install the python package and its dependencies (optional, without this option the script will install the package and run it)'
|
| 25 |
echo " -p --python-executable <python_executable> Specifies the python executable to use (optional, without this option the default python3 executable (${python_executable}) will be used)"
|
| 26 |
echo " -o --allowed-origin <allowed_origin> Specifies the allowed origin for the webserver (optional, without this option the default value (${ALLOWED_ORIGIN}) will be used)"
|
|
|
|
| 64 |
only_install=YES
|
| 65 |
shift # past argument
|
| 66 |
;;
|
| 67 |
+
-d|--download-nltk)
|
| 68 |
+
download_nltk=YES
|
| 69 |
+
echo "# download_nltk: '${download_nltk}'"
|
| 70 |
+
shift # past argument
|
| 71 |
+
;;
|
| 72 |
*) echo "Unknown parameter passed: '$1'";
|
| 73 |
display_help
|
| 74 |
exit 1
|
|
|
|
| 109 |
# gitlab prefix: https://gitlab.com/{GITLAB_USER}/{GITLAB_REPO}/-/raw
|
| 110 |
URL_REPOSITORY_PREFIX="https://raw.githubusercontent.com/${GITHUB_USER}/${GITHUB_REPO}/refs/tags/${MGW_VERSION}"
|
| 111 |
python -m pip install my-ghost-writer -r "${URL_REPOSITORY_PREFIX}/requirements-webserver.txt"
|
| 112 |
+
|
| 113 |
+
if [ "$download_nltk" = "YES" ]; then
|
| 114 |
+
echo -e "\n# install required NLTK data files (crubadan):"
|
| 115 |
+
python -m nltk.downloader -d "${VIRTUALENV_FOLDER}/nltk_data" crubadan
|
| 116 |
+
fi
|
| 117 |
+
|
| 118 |
echo -e "\n# installed my-ghost-writer version: ${MGW_VERSION}!"
|
| 119 |
}
|
| 120 |
|