From 03c0cc528a41336b52a896b0b27d006939a8c30f Mon Sep 17 00:00:00 2001 From: lpmi-13 Date: Thu, 14 Mar 2019 22:13:13 +0000 Subject: [PATCH] add Dockerfile for automated build --- Dockerfile | 57 ++++++++++++++++++++++++++ README.md | 71 ++++++++++++++++++++++++++++++++ models.sh | 9 +++++ pom.xml | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 254 insertions(+) create mode 100644 Dockerfile create mode 100755 models.sh create mode 100644 pom.xml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4c69bce --- /dev/null +++ b/Dockerfile @@ -0,0 +1,57 @@ +from ubuntu:16.04 + +# install dependencies +RUN apt-get update && \ + apt-get install -y default-jdk ant maven python2.7 graphviz \ + jam libboost-all-dev zlib1g-dev gfortran g++ make \ + git wget + +# set up all the environment variables +ENV JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" \ + OPENCCG_HOME="/openccg" \ + ANT_HOME="/usr/share/ant" +ENV PATH="$PATH:$OPENCCG_HOME/bin" +ENV PATH="$PATH:$ANT_HOME/bin" +ENV PATH="$PATH:/maxent/src/opt" + +COPY . ./openccg + +WORKDIR /openccg + +# optionally build models if they are present +RUN ./models.sh && \ +# # set up all the jar dependencies + mvn dependency:copy-dependencies -DoutputDirectory='./lib' && \ + # set up stanford core nlp dependencies + mv lib/stanford-corenlp-3.9.2.jar ccgbank/stanford-nlp/stanford-core-nlp.jar && \ + jar xf lib/stanford-corenlp-3.9.2-models.jar && \ + cp edu/stanford/nlp/models/ner/* ccgbank/stanford-nlp/classifiers/ && \ + rm -rf edu && \ + # set up the project + ccg-build + +# # set up the maxent toolkit +#WORKDIR /usr/share +# +#RUN git clone https://github.com/lzhang10/maxent +# +#WORKDIR /usr/share/maxent +# +#RUN ./configure && make && make install + +# # set up the srilm tools +#WORKDIR /usr/share +# +#RUN wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/moses-suite/srilm-1.6.0.simple.tar.gz && \ +# tar xzf srilm-1.6.0.simple.tar.gz && \ +# cd srilm-1.6.0 && \ +# # set the path to SRILM +# sed -i "s/# SRILM =.*/SRILM = \/usr\/share\/srilm-1.6.0/" Makefile && \ +# # for 64 bit systems +# make MACHINE_TYPE=i686-m64 +# # for 32 bit systems (not tested, but might work) +# #make MACHINE_TYPE=i686 + +#WORKDIR /openccg + +CMD ["bash"] diff --git a/README.md b/README.md index 0f1214c..4ed9623 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,77 @@ The Eclipse IDE can be used for editing the Java source code, though setup can b Note that with Eclipse's default settings, the code will compile in your Eclipse workspace, which is separate from your OpenCCG installation (this is a good thing, as Eclipse uses a `bin/` directory for compiled Java classes, whereas OpenCCG uses `bin/` for command-line scripts). Thus, once you have made a round of changes in Eclipse and are ready to try them out in OpenCCG, go back to the command line in `$OPENCCG_HOME` and invoke `ccg-build` to re-build the `openccg.jar` file. This will make your changes available in OpenCCG's programs, such as `tccg`. +# Running locally with Docker + +Alternately, if you would prefer using Docker rather than +configuring and building everything yourself, that's also possible. + +## Installation + +* Installing docker for Windows + +For instructions on how to install docker for Windows 10, go +[here](https://docs.docker.com/docker-for-windows/install/), +or for slightly older Windows computers, +go [here](https://docs.docker.com/toolbox/overview/). + +* Installing docker for MacOS + +For instructions on how to install docker for MacOS (at +least El Capitan 10.11), go +[here](https://docs.docker.com/docker-for-mac/install/), +or for slightly older MacOS computers, +go [here](https://docs.docker.com/toolbox/overview/) + +* Installing docker on Linux + +For instructions on how to install docker for Ubuntu (at +least 14.04), go [here](https://docs.docker.com/install/linux/docker-ce/ubuntu/). This link also has options for other +Linux distributions. + + +to test your installation, just type: +`docker --version` +at the terminal/command prompt + +A successful install will result in something that looks like: +`Docker version 17.05.0-ce, build 89658be` + +## Running in a container + +Once you have docker up and running, the following command will +help you build from the Dockerfile: +`docker build -t YOUR_TAG_HERE .` +(the tag is so it's easy to reference later) + +After the container is finished building, you can run it with: +`docker run -it --rm -t YOUR_TAG_HERE` + +When you're finished just type `exit` to leave the container. + +## Functionality in the container + +The following functions should work immediately once the container is built: + +- tccg command line tool +- visualizing the semantic graphs +- parsing +- realization + +If you want to use the pre-built statistical models (referenced as `english-models.YYYY-MM-DD.tgz` in `docs/ccgbank-README`), just follow the instructions there and be sure to copy the renamed file (eg, `english-models.tgz`) into the `ccgbank` directory locally, then build the container and `models.sh` will automatically extract it for you. + +If you want to use the tagging capabilities listed in +`docs/taggers-README` utilizing the Maxent toolkit and SRILM, +uncomment those lines in the `Dockerfile`, and build as normal. + +--- + +The following functions are not currently set up by default inside the container: + +- building the English models from the CCGBank +(the CCGBank is licensed, and so dealing with it hasn't been included in this public docker image) + + # Bug Reports Please report bugs at by creating [an issue with a description of the problem](https://github.com/OpenCCG/openccg/issues). diff --git a/models.sh b/models.sh new file mode 100755 index 0000000..4ea4756 --- /dev/null +++ b/models.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +FILE=/openccg/ccgbank/english-models.tgz + +if [ -f "$FILE" ]; then + ccg-build -f ccgbank/build-release.xml extract-models +else + echo "$FILE does not exist, skipping this step" +fi diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..956e59a --- /dev/null +++ b/pom.xml @@ -0,0 +1,117 @@ + + + 4.0.0 + + openccg + openccg + 0.0.1-SNAPSHOT + + + + + ant-contrib + ant-contrib + 1.0b3 + + + + org.jdom + jdom + 1.1 + + + + net.sf.jgrapht + jgrapht + 0.8.3 + + + + jline + jline + 1.0 + + + + junit + junit + 4.10 + test + + + + trove + trove + 1.0.2 + + + + xalan + xalan + 2.7.1 + + + + xerces + xercesImpl + 2.9.0 + + + + xml-apis + xml-apis + 1.0.b2 + + + + xalan + serializer + 2.7.1 + + + + net.sf.jopt-simple + jopt-simple + 3.1 + + + + net.java.dev.javacc + javacc + 4.0 + + + + edu.stanford.nlp + stanford-corenlp + 3.9.2 + + + + edu.stanford.nlp + stanford-corenlp + 3.9.2 + models + + + + + + lib + + + org.apache.maven.plugins + maven-dependency-plugin + + + ${project.build.directory} + + + + + + +