From 4a82a06a46e4cce17511346808aaf47cb4dbc104 Mon Sep 17 00:00:00 2001 From: Gerardo Bort <gerardobort@gmail.com> Date: Sun, 7 Jul 2019 22:41:59 -0300 Subject: [PATCH] doc(*): Adding docker config for help ... wip --- Dockerfile | 14 ++++++++++++++ examples/browser/index.html | 4 ++-- examples/browser/server.sh | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ea0c7b6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM nlpbox/corenlp + +WORKDIR /opt/corenlp + +ADD examples examples +RUN chmod +x examples/browser/server.sh +RUN apk update && apk add python3 + +ENV JAVA_XMX 4g +ENV PORT 9000 +EXPOSE $PORT +EXPOSE 8000 + +CMD cd examples/browser && ./server.sh && cd - && java -Xmx$JAVA_XMX -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000 diff --git a/examples/browser/index.html b/examples/browser/index.html index 55d3e98..b0e64fd 100644 --- a/examples/browser/index.html +++ b/examples/browser/index.html @@ -10,8 +10,8 @@ <h1>CoreNLP client side example</h1> <script> const connector = new CoreNLP.ConnectorServer({ dsn: 'http://localhost:9000' }); const props = new CoreNLP.Properties({ annotators: 'tokenize,ssplit,pos,lemma,ner,parse' }); - const pipeline = new CoreNLP.Pipeline(props, 'Spanish', connector); - const sent = new CoreNLP.default.simple.Sentence('A los pibes les gusta tomar Fernet con Coca.'); + const pipeline = new CoreNLP.Pipeline(props, 'English', connector); + const sent = new CoreNLP.default.simple.Sentence('This is so great!'); pipeline.annotate(sent) .then(function(sent) { console.log(sent); diff --git a/examples/browser/server.sh b/examples/browser/server.sh index 327ddcf..9032151 100644 --- a/examples/browser/server.sh +++ b/examples/browser/server.sh @@ -1,2 +1,2 @@ -python -m SimpleHTTPServer 8000 +python3 -m http.server 8000 --bind 0.0.0.0 & echo "open http://localhost:8000"