Skip to content

Instantly share code, notes, and snippets.

@lielran
Last active September 24, 2019 12:55
Show Gist options
  • Save lielran/10adeb1f697e2b122d5722dac38baf53 to your computer and use it in GitHub Desktop.
Save lielran/10adeb1f697e2b122d5722dac38baf53 to your computer and use it in GitHub Desktop.
Extract custom model
#!/bin/sh
set -e
BASE_MODEL_DIR=$1
BASE_DIR="${AMENITY_PATH:-/data/VSA_Structure}"
CUSTOM_DATA_FOLDER="$BASE_DIR/custom_data"
echo "searching for custom model in the volume ${BASE_MODEL_DIR} to extract before SA engine"
if [ -d $BASE_MODEL_DIR ]
then
echo "Model mount was found. searching for model zip"
ls $BASE_MODEL_DIR
zipFile=$(find ${BASE_MODEL_DIR} -name \*.zip |head -n 1)
if [ -z "$zipFile" ]
then
echo "model \$zipFile was not found. not extrating custom model"
else
echo "model was found in this path $zipFile"
rm -rf ${CUSTOM_DATA_FOLDER} && mkdir -p ${CUSTOM_DATA_FOLDER}
unzip -o ${zipFile} 'Default_Files/**' -d ${CUSTOM_DATA_FOLDER}
mv ${CUSTOM_DATA_FOLDER}/Default_Files/** $CUSTOM_DATA_FOLDER/ && rm -r $CUSTOM_DATA_FOLDER/Default_Files
mv ${CUSTOM_DATA_FOLDER}/*_SAEventThresholds.txt $CUSTOM_DATA_FOLDER/SAEventThresholds.txt
mv ${CUSTOM_DATA_FOLDER}/*_SentimentLexiconRuleSet.txt ${CUSTOM_DATA_FOLDER}/SentimentLexiconRuleSet.txt
fi
else
echo "The models folder was not found!(${BASE_MODEL_DIR})"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment