view demo/workspace/semantic_analysis.sh @ 0:90155bdd5dd6

first commit
author Emmanouil Theofanis Chourdakis <e.t.chourdakis@qmul.ac.uk>
date Wed, 16 May 2018 18:27:05 +0100
parents
children d0ac6786c3b9
line wrap: on
line source
#!/bin/bash

if [ ! -f story.txt ]; then
    touch story.txt
fi

xdg-open story.txt
read -p "Please edit and save a new story. Then press enter to continue."

cd ..
python3 text2annotation.py workspace/story.txt ner_model.pkl rel_model.pkl
cd -

if [ -d ../../brat/data/workspace ]; then
    rm ../../brat/data/workspace/*txt
    rm ../../brat/data/workspace/*ann
else
    mkdir ../../brat/data/workspace
    cp ../../brat/data/training/annotation.conf ../../brat/data/workspace
fi

cp story_processed.txt story_processed.ann ../../brat/data/workspace
cp annotation.conf ../../brat/data/workspace

cd ../../brat

python2 standalone.py &
PID=$!

echo "Please visit http://0.0.0.0:8001/index.xhtml#/workspace/story_processed"
echo "login with user:au1/pass:au1 and make your changes, and then press enter here"
xdg-open 'http://0.0.0.0:8001/index.xhtml#/workspace/story_processed'
cd -
read
kill $PID

echo "Copying files over to current directory"

cp -f ../../brat/data/workspace/story_processed.txt .
cp -f ../../brat/data/workspace/story_processed.ann .

cd ..
python3 annotation2script.py workspace/story_processed.ann workspace/story_quotes.json
echo "Please edit the transcript .xls file if necessary. If you want to replace the voices, just record your voice and store them"
echo "using the filenames under column 'filename' in transcript.xls. Do the same for sfx.xls. Press enter here when you're done"
xdg-open workspace/transcript.xls
xdg-open workspace/sfx.xls
cd -
read

echo "Generated script is at story_processed_script.txt"
cat story_processed_script.txt