Skip to content

Commit

Permalink
Merge pull request #3 from chilland/update
Browse files Browse the repository at this point in the history
Update corenlp and add shift reduce parser
  • Loading branch information
chilland authored Dec 10, 2020
2 parents 8e5b16d + 8b48000 commit 285c48f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 8 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish Docker image
on:
release:
types: [published]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to Docker Hub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: chilland/corenlp
tag_with_ref: true
21 changes: 15 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
FROM java:8
FROM maven:alpine

MAINTAINER Casey Hilland <casey dot hilland at gmail dot com>
RUN apk add --update --no-cache \
unzip wget

RUN wget http://nlp.stanford.edu/software/stanford-corenlp-full-2015-12-09.zip
RUN unzip stanford-corenlp-full-2015-12-09.zip && rm stanford-corenlp-full-2015-12-09.zip
ARG CORENLP_VERSION="4.2.0"

WORKDIR stanford-corenlp-full-2015-12-09
RUN wget http://nlp.stanford.edu/software/stanford-corenlp-${CORENLP_VERSION}.zip
RUN unzip stanford-corenlp-${CORENLP_VERSION}.zip && \
rm stanford-corenlp-${CORENLP_VERSION}.zip

WORKDIR stanford-corenlp-${CORENLP_VERSION}

RUN wget https://nlp.stanford.edu/software/stanford-srparser-2014-10-23-models.jar
RUN mvn install:install-file -Dfile=stanford-srparser-2014-10-23-models.jar \
-DgroupId=edu.stanford.nlp -DartifactId=stanford-srparser \
-Dversion=3.5.2 -Dpackaging=jar

RUN export CLASSPATH="`find . -name '*.jar'`"

EXPOSE 9000

CMD java -cp "*" -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer
CMD java -cp "*" -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -parse.model edu/stanford/nlp/models/srparser/englishSR.ser.gz
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,22 @@ Dockerfile for Stanford CoreNLP Server
---------

This Dockerfile builds the [Stanford CoreNLP
Server](http://stanfordnlp.github.io/CoreNLP/corenlp-server.html) and exposes
the endpoint on port 9000. Requests are made as covered in the documentation.
Server](http://stanfordnlp.github.io/CoreNLP/corenlp-server.html) and
shift-reduce parser. It exposes the endpoint on port 9000. Requests
are made as covered in the documentation. Including the shift-reduce parser
makes the image rather large (2.5gb+). You can specify the version you want to
build via `--build-arg`.

## Build

```shell
docker build --build-arg CORENLP_VERSION=${CORENLP_VERSION} -t corenlp:${CORENLP_VERSION} .
```

## Run
The container runs the server with some simple defaults and runs the jar with
4gb of memory. The command can be overriden when you start the container. For
example:
```shell
docker run -p 9000:9000 -d corenlp java -cp "*" -mx15g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -parse.model edu/stanford/nlp/models/srparser/englishSR.ser.gz -preload tokenize,ssplit,pos,lemma,depparse,ner,kbp,relation,coref,quote,sentiment -quiet
```

0 comments on commit 285c48f

Please sign in to comment.