Skip to content

Commit 285c48f

Browse files
authored
Merge pull request #3 from chilland/update
Update corenlp and add shift reduce parser
2 parents 8e5b16d + 8b48000 commit 285c48f

File tree

3 files changed

+52
-8
lines changed

3 files changed

+52
-8
lines changed

.github/workflows/docker.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Publish Docker image
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
push_to_registry:
7+
name: Push Docker image to Docker Hub
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out the repo
11+
uses: actions/checkout@v2
12+
- name: Push to Docker Hub
13+
uses: docker/build-push-action@v1
14+
with:
15+
username: ${{ secrets.DOCKER_USERNAME }}
16+
password: ${{ secrets.DOCKER_PASSWORD }}
17+
repository: chilland/corenlp
18+
tag_with_ref: true

Dockerfile

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
FROM java:8
1+
FROM maven:alpine
22

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

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

8-
WORKDIR stanford-corenlp-full-2015-12-09
8+
RUN wget http://nlp.stanford.edu/software/stanford-corenlp-${CORENLP_VERSION}.zip
9+
RUN unzip stanford-corenlp-${CORENLP_VERSION}.zip && \
10+
rm stanford-corenlp-${CORENLP_VERSION}.zip
11+
12+
WORKDIR stanford-corenlp-${CORENLP_VERSION}
13+
14+
RUN wget https://nlp.stanford.edu/software/stanford-srparser-2014-10-23-models.jar
15+
RUN mvn install:install-file -Dfile=stanford-srparser-2014-10-23-models.jar \
16+
-DgroupId=edu.stanford.nlp -DartifactId=stanford-srparser \
17+
-Dversion=3.5.2 -Dpackaging=jar
918

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

1221
EXPOSE 9000
1322

14-
CMD java -cp "*" -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer
23+
CMD java -cp "*" -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -parse.model edu/stanford/nlp/models/srparser/englishSR.ser.gz

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,22 @@ Dockerfile for Stanford CoreNLP Server
33
---------
44

55
This Dockerfile builds the [Stanford CoreNLP
6-
Server](http://stanfordnlp.github.io/CoreNLP/corenlp-server.html) and exposes
7-
the endpoint on port 9000. Requests are made as covered in the documentation.
6+
Server](http://stanfordnlp.github.io/CoreNLP/corenlp-server.html) and
7+
shift-reduce parser. It exposes the endpoint on port 9000. Requests
8+
are made as covered in the documentation. Including the shift-reduce parser
9+
makes the image rather large (2.5gb+). You can specify the version you want to
10+
build via `--build-arg`.
11+
12+
## Build
13+
14+
```shell
15+
docker build --build-arg CORENLP_VERSION=${CORENLP_VERSION} -t corenlp:${CORENLP_VERSION} .
16+
```
17+
18+
## Run
19+
The container runs the server with some simple defaults and runs the jar with
20+
4gb of memory. The command can be overriden when you start the container. For
21+
example:
22+
```shell
23+
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
24+
```

0 commit comments

Comments
 (0)