Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Docker container for NER-node with requisite Java and Node. Creates web API endpoint to process all NER requests.

License

Notifications You must be signed in to change notification settings

jamesvillarrubia/docker-ner-node

Repository files navigation

Docker NER-node

This container spins up a Docker container at port 4321, talking to a Node Express engine at port 8080, which is managing a set of child spawns of the Stanford NER library at port 1234. Docker prevents install mistakes. Node/Express handle the json formatting and easy to configure API endpoints and pools/threads. Stanford handles the rest of it. Not the most elegant, but it works and it works fast. Great for dev projects and small efforts. Needs work before large scale production roll out. If you are using this in production, you should probably get someone to load the Java runtime directly in a scalable pool... just saying :)

Installing

I'm assuming you've got docker installed, etc. From the command line:

docker run jamesmtc/ner-node

It will then download the Node container, install JAVA 8 JDK, and the NER library, and then kick off the app.

The app is running on port 8080.

Running the full stack

To run the docker image on localhost:4321, I use the command

docker run -it -p 4321:8080 jamesmtc/ner-node

which allows me to see calls come in or to run in the background for prod

docker run -d -p 4321:8080 jamesmtc/ner-node

Example Calls

There are three endpoints available now at port 4321

POST - localhost:4321/
GET - localhost:4321/close
GET - localhost:4321/restart

To POST data and receive a response, send a JSON request with your string as the "data" property:

{
   "data":"This sentence is going to get parsed and JP Morgan will be pulled out"
}

which should return

{
  "ORGANIZATION": [
    "JP Morgan"
  ]
}

Stopping/Starting

To stop the NER node child processes(managing the JAVA processes), just request the /close endpoint To restart it... just send a GET request to /restart

Known bugs

Not sure how to do keep-alive checks within the docker yet. Perhaps foreverjs? Looking to productize it a bit as well. ANY PRs ARE WELCOME!! https://github.com/jamesvillarrubia/docker-ner-node

About

Docker container for NER-node with requisite Java and Node. Creates web API endpoint to process all NER requests.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published