Using CoreNLP within other programming languages and packages
Table of contents
Below are interfaces and packages for running Stanford CoreNLP from other languages or within other packages. They have been written by many other people (thanks!). In general you should contact these people directly if you have problems with these packages.
C#/F#/.NET
- Stanford CoreNLP for .NET by Sergey Tihon. See also: NuGet page.
Clojure
- Clojure wrapper for CoreNLP by Cory Giles, Hans Engel, and Damien Stanton. Incomplete. Currently only a tagger and parser.
- Clojure wrapper for CoreNLP by Nils Gruenwald. Incomplete. Currently only wraps tagger and TokensRegex.
Docker
Okay, Docker isn’t a language, but you know what we mean….
Note on running the CoreNLP server under docker: The container’s port 9000 has to be published to the host. For example, give a command like: docker run -p 9000:9000 --name coreNLP --rm -i -t motiz88/corenlp
. If, when going to localhost:9000/
, you see the error This site can’t be reached. localhost refused to connect
, then this is what you failed to do!
- CoreNLP Complete dockerfile A Dockerfile for Stanford CoreNLP server by Graham MacDonald. Comes with good examples of use. Updated in Dec 2018. GitHub
- stanford-corenlp-docker A dockerfile by Arne Neumann. Updated Oct 2018. The NLPBox project provides dockerfiles for many NLP tools.
- corenlp-docker A Dockerfile for Stanford CoreNLP Server by motiz88.
- corenlp-docker And another by vzhong, a Stanford NLP graduate.
And there are many others – it’s not so hard to build a dockerfile. Here are a few more:
- corenlp-docker Another by chilland.
- corenlp-zmq By twneale. As the name says, this one has a ZMQ broker front end.
- stanford-corenlp-server By akiomik.
- corenlp-server Another by hotpxl.
- jamesbpollack/corenlp-stack by James Pollack.
Elixir
Go (golang)
- go-corenlp is a Golang wrapper for CoreNLP by Hironobu Saito.
Java
- DKPro Core is a collection of NLP components, wrapped as UIMA components. It includes the Stanford CoreNLP components, and there is a tutorial on how to use them in the DKPro Core documentation. DKPro Core is part of the DKPro community. It is well-maintained and our recommended way of using Stanford CoreNLP within UIMA. DKPro Core was principally developed by Richard Eckart de Castilho at the Ubiquitous Processing Lab (UKP) at the Technische Universität Darmstadt.
- cleartk-stanford-corenlp is a UIMA wrapper for Stanford CoreNLP built by Steven Bethard in the context of the ClearTK toolkit.
- A Vert.x module for acccessing Stanford CoreNLP by Jonny Wray.
- Wrapper for each of Stanford’s Chinese tools by Mingli Yuan.
- RESTful API for integrating between Stanford CoreNLP and Apache Stanbol by Rupert Westenthaler and Cristian Petroaca.
JavaScript (node.js)
- corenlp (github site) by Gerardo Bort is an actively developed node.js CoreNLP library. Multilingual support. You can run this package in your browser, using RunKit.
- corenlp-sentiment adds support for sentiment analysis to the above corenlp package. By Garrick James McMickell.
- stanford-corenlp (github site) is a simple node.js wrapper by hiteshjoshi.
- CoreNLP-client (GitHub site) is a simple corenlp client to the corenlp http server using request-promise by Romain Beaumont. Extended by Christophe B. for multilingual use as corenlp-client-multilang (github site). The latter has multilingual support.
- corenlp-request-wrapper (github site) is a wrapper for a Stanford CoreNLP server by nash403.
Other choices are now probably best avoided:
- corenlp-js-interface is the simplest interface with CoreNLP server in node.js. The GitHub site is no longer available.
- corenlp-js-prefab a simple interface to the CoreNLP server with a prefab function so you only have to send text no extra parameters with each call. By Noah Dessauer. The GitHub site is no longer available.
- stanford-corenlp-node (github site) is a webservice interface to CoreNLP in node.js by Mike Hewett. No recent development.
- stanford-simple-nlp (github site) is a node.js CoreNLP wrapper by Taeho Kim (xissy). This doesn’t seem to have been updated lately. You’re better off with something else.
Lua
- CoreNLP.lua. Lua client for StanfordCoreNLPServer by Victor Zhong
Perl
- Perl wrapper by Kalle Raeisaenen.
PHP
- php-stanford-corenlp-adapter by Dennis De Swart. Well-maintained client connection to Stanford CoreNLP server. PHPclasses. Packagist.
- php-stanford-nlp-datastore by Dennis De Swart. Stores data analyzed by Stanford CoreNLP (words, NER, OpenIE triples, coreference) in an SQLite database, which can then be searched. PHPclasses. Packagist.
Python
Official StanfordNLP Package
We are actively developing a Python package called StanfordNLP. This package includes an API for starting and making requests to a Stanford CoreNLP server. It is the recommended way to use Stanford CoreNLP in Python.
- StanfordNLP Official Stanford NLP Python package, covering 70+ languages
Packages using the Stanford CoreNLP server
These packages use the Stanford CoreNLP server that we’ve developed over the last couple of years.
- stanfordcorenlp by Lynten Guo. A Python wrapper to Stanford CoreNLP server, version 3.9.1. PyPI page:
pip install stanfordcorenlp
- pycorenlp, A Python wrapper for Stanford CoreNLP by Smitha Milli that uses the new CoreNLP v3.6+ server. Available on PyPI.
- corenlp-pywrap by Sherin Thomas also uses the new CoreNLP v3.6+ server. Python 3.x (only). Also: PyPI page.
- Stanford CoreNLP Python Interface: A reference implementation of a Python interface to the Stanford CoreNLP server. By Arun Chaganty. PyPI page:
pip install stanford-corenlp
PyPI page. - pynlp A (Pythonic) Python wrapper for Stanford CoreNLP by Sina. PyPI page.
- NLTK since version 3.2.3 has a new interface to Stanford CoreNLP using the StanfordCoreNLPServer:
nltk.parse.corenlp.CoreNLPParser
. There is a nice page of instructions. See also: instructions on using the dependency parser and the code for this module. Much of this work was done by Dmitrijs Milajevs. You should avoid using the Stanford tokenizer/segmenter/NER fromnltk.tokenize
andnltk.tag
(unless stuck on a very old version of NLTK) – these classes are very slow, since they perform calls to Java via the command-line for each invocation.
Miscellaneous Python packages
These packages are miscellaneous utilities or other frameworks that use Stanford CoreNLP.
- python-corenlp-protobuf: Stanford CoreNLP Python Bindings by Arun Chaganty. This package contains python bindings for Stanford CoreNLP’s protobuf specifications, as generated by protoc. These bindings can used to parse binary data produced by, e.g., the Stanford CoreNLP server. PyPI page.
- PyStanfordDependencies , a Python interface for converting Penn Treebank trees to Stanford Dependencies by David McClosky (see also: PyPI page). Last we checked, it is at Stanford CoreNLP v3.5.2 and can do Universal and Stanford dependencies (though it’s currently missing Universal POS tags and features).
- corenlp-xml, a library for handling interactions with CoreNLP’s XML output by Robert Elwell. Available on PyPI. Documentation.
- corpkit, a sophisticated corpus linguistics toolkit with GUI by Daniel McDonald. Interfaces with CoreNLP v3.6.0 to parse documents, and uses Tregex/CoreNLP XML to find patterns in corpora. Available on PyPI. A graphical interface is also available.
- corenlp-xml-reader by Edward Newell on GitHub and there it’s a PyPI package. He also has corenlpy, which runs Java in a subprocess – github
Older Python packages
These are previous generation Python interfaces to Stanford CoreNLP, using a subprocess or their own server. They are now not generally being developed and are obsolete. (But thanks a lot to the people who wrote them in the early days!)
- The “Wordseer fork” of stanford-corenlp-python, a Python wrapper for Stanford CoreNLP (see also: PyPI page). The “Wordseer fork” seems to merge the work of a number of people building on the original Dustin Smith wrapper, namely: Hiroyoshi Komatsu, Johannes Castner, Robert Elwell, Tristan Chong, Aditi Muralidharan. At Stanford CoreNLP v3.5.2, last we checked. See also Robert Elwell’s version (at CoreNLP v3.2.0, last we checked).
- stanford-corepywrapper Python wrapper by Brendan O’Connor or maybe John Beieler’s fork. At CoreNLP v3.5.0, last we checked.
- corenlp-python , an up-to-date fork of Smith (below) by Hiroyoshi Komatsu and Johannes Castner (see also: PyPI page). At CoreNLP v3.4.1, last we checked.
- stanford-corenlp-python , the original Python wrapper including JSON-RPC server by Dustin Smith. At CoreNLP v3.4.1, last we checked.
- corenlp , a Python wrapper for Stanford CoreNLP by Chris Kedzie (see also: PyPI page). At Stanford CoreNLP v3.2.0, last we checked.
R (CRAN)
- cleanNLP: A Tidy Data Model for Natural Language Processing by Taylor Arnold. GitHub. Paper: pdf.
- coreNLP: Wrappers Around Stanford CoreNLP Tools by Taylor Arnold and Lauren Tilton. Github. Supports CoreNLP version ≥ 3.5.2.
- NLP: Natural Language Processing Infrastructure by Kurt Hornik. Code and models available here.
Ruby
- Stanford CoreNLP Ruby bindings by Louis Mullie (see also: Ruby Gems page). (Updated in Feb 2017 to CoreNLP 3.5.0.)
- The larger TREAT NLP toolkit by Louis Mullie also makes available Stanford CoreNLP.
- corenlp by Lengio Corp. is another interface to CoreNLP (last updated for CoreNLP 3.4).
- stanford-core-nlp by Will Hayworth is another older interface to CoreNLP (also for CoreNLP 3.4).
Scala
CoreNLP wrapper for Spark v0.1 by Xiangrui Meng of Databricks.
Scala API for CoreNLP by Mihai Surdeanu, one of the original developers of the CoreNLP package.
Thrift server
- Apache Thrift server for Stanford CoreNLP by Diane Napolitano. (Written in Java, but usable from many languages.)
XQuery
- exist-stanford-nlp by Loren Cahlander
ZeroMQ/ØMQ servers
- stanford-0mq by Diane Napolitano. An implementation of a server for Stanford’s CoreNLP suite using Ømq and a basic client/server/JSON requests configuration. Last commit: Oct 2015.
- stanford-corenlp-zeromq by URXtech. Basic JSON wrapper around CoreNLP.
- corenlp-zmq by Thom Neale. A Dockerfile and Ansible provisioning script to build and run a Stanford CoreNLP server process with a single ZMQ broker font-end that proxies incoming requests to one or more back-end Scala workers. Last commit: 2015.
- corenlp-server by Eric Kow. Simple Java server communicating with clients via XML through ZeroMQ. Example Python client included. Last commit: 2014.