diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6d2a1e7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.9 +RUN echo export PATH=$HOME/.local/bin:$PATH >> ~/.bashrc +COPY requirements.txt requirements.txt +RUN apt-get update +RUN apt-get install -y make +RUN apt-get install -y texlive-latex-extra +RUN git clone --recursive https://github.com/andreasvc/disco-dop.git +RUN cd disco-dop +RUN pip install --user --no-cache-dir -r requirements.txt +WORKDIR /disco-dop/ +RUN pip install sphinx +RUN mkdir -p _static +RUN make install +RUN pip install grapheme +WORKDIR ~/activedopmeru/ +ENV FLASK_APP=app.py +ENV FLASK_RUN_HOST=0.0.0.0 +ENV FLASK_ENV=development +COPY . . +EXPOSE 5000 +RUN python -m flask initdb +RUN python -m flask initpriorities +CMD ["python", "-m", "flask", "run", "--with-threads"] diff --git a/annotate.db b/annotate.db new file mode 100644 index 0000000..39fab85 Binary files /dev/null and b/annotate.db differ diff --git a/app.py b/app.py index 5d1a735..e667eab 100644 --- a/app.py +++ b/app.py @@ -1138,6 +1138,7 @@ def accept(): actions = session['actions'] actions[TIME] = int(round(time() - actions[TIME])) treestr = None + #tags = {} if 'dec' in request.args: actions[DECTREE] += int(request.args.get('dec', 0)) if 'tree' in request.args: @@ -1293,8 +1294,7 @@ def download_pdf(): subprocess.run(['pdflatex', '-output-directory', output_dir, os.path.join(output_dir, "file.tex")]) - pdf_path = os.path.join(output_dir, "file.pdf") - + pdf_path = os.path.join(output_dir, "file.pdf") return send_file(pdf_path, as_attachment=True, attachment_filename='downloaded_file.pdf') @app.route('/annotate/exportcgeltree') @@ -1654,4 +1654,4 @@ def strip_cgel_metadata(orig_senttok): treestr = "(ROOT " + cgel_tree.ptb() + ")" treestr = writediscbrackettree(DrawTree(treestr).nodes[0],new_senttok) orig_senttok = new_senttok - return(treestr, orig_senttok, tags, orig_tree) \ No newline at end of file + return(treestr, orig_senttok, tags, orig_tree) diff --git a/newsentsExample.csv.rankings.json b/newsentsExample.csv.rankings.json new file mode 100644 index 0000000..79d725e --- /dev/null +++ b/newsentsExample.csv.rankings.json @@ -0,0 +1,56 @@ +[ + [ + 3, + 3.6736298275241372, + "The girl ate pizza with tomatoes", + "id4" + ], + [ + 1, + 2.702709644336757, + "The girl ate the pizza with a fork", + "id2" + ], + [ + 2, + 2.5013714625137196, + "The girl ate the pizza with the tomatoes", + "id3" + ], + [ + 0, + 1.6475508327726855, + "The boy saw the girl under the tree with the telescope in the forest", + "id1" + ], + [ + 7, + 0.8895849807473573, + "The mouse saw the little cat", + "id8" + ], + [ + 4, + -0.0, + "The cat saw the pizza", + "id5" + ], + [ + 5, + -0.0, + "The mouse stole the pizza", + "id6" + ], + [ + 6, + -0.0, + "The cat ate the mouse", + "id7" + ], + [ + 8, + -0.0, + "The cat ate the dog", + "id9" + ] +] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e091441..d53b6b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ numpy scikit-learn pylatexenc Werkzeug==2.2.2 +Cython==0.29.37 diff --git a/settings.cfg b/settings.cfg index cca85fd..6839608 100644 --- a/settings.cfg +++ b/settings.cfg @@ -1,7 +1,7 @@ SECRET_KEY=b';boc.xbanuh;qdaoeiq' DEBUG = False GRAMMAR = 'cgelbank2/' -SENTENCES = 'ewt-manual.cgelpos' +SENTENCES = 'newsentsExample.csv' LIMIT = 70 ANNOTATIONHELP = None ACCOUNTS = { diff --git a/templates/annotate.html b/templates/annotate.html index 8c3ca49..e3c155d 100644 --- a/templates/annotate.html +++ b/templates/annotate.html @@ -40,47 +40,48 @@ - +{%block script %} - +{% endblock %}
diff --git a/templates/edittree.html b/templates/edittree.html index 3bb655e..d744984 100644 --- a/templates/edittree.html +++ b/templates/edittree.html @@ -32,34 +32,41 @@ {{ msg }} +{%block script %} + + +{% endblock %} +