Chuniversiteit.nl
The Toilet Paper

A replicable comparison study of NER software: StanfordNLP, NLTK, OpenNLP, SpaCy, GATE

Named entity recognition (NER) can be used to detect entities like people and locations in text. Which OSS library gives you the best results?

Template
What’s your favourite thing about SpaCy? Mine’s SpaCy.

Natural language processing (NLP) is a subfield of artificial intelligence that is dedicated to the understanding, processing, and generation of natural languages, like French and English.

Named entity recognition (NER) is a subtask of NLP that aims to identify entities (persons, locations) in texts. This can be used for things like machine translation, automated question answering, and automated text summarisation.

Why it matters

If you need NER, there’s no need to implement it yourself. There are several popular libraries that can do this for you nowadays. Five of these libraries, , NLTK, OpenNLP, SpaCy, and GATE, were already mentioned in the title.

Which library is right for you depends on various criteria, like its performance, cost, documentation, license, and the programming language in which it is implemented.

Many of these libraries have been evaluated in comparison studies, but sadly not in a way that makes it easy to compare findings.

How the study was conducted

This paper describes a comparison between the five aforementioned NER libraries, in a sufficiently clear and complete way, so that its results can be replicated.

The process looks roughly like this:

  1. Selection of two that are not domain-specific, freely available, and in English: the Groningen Meaning Bank (GMB) and the CoNLL 2003 corpus.

  2. Selection of five NER libraries that are free and open-source software, well-documented, available for Linux, and can recognise at least three types of entities: persons, organisations, and locations.

  3. Comparison of each NER library’s generated NER annotations with annotations in the “gold data”, which contains the annotations that we’d expect. This is done by computing the precision, recall, and F-score for each library.

What discoveries were made

The table below shows the results of the comparison.

CoNLL 2003GMB
LibraryEntityPrecisionRecallF-scorePrecisionRecallF-score
Stanford NLPLocation91.3088.7390.0083.1063.6472.08
Organisation86.3280.9283.5371.4047.4256.99
Person92.7282.6887.4178.5984.7081.53
Overall90.0673.6781.0579.8163.7470.88
NLTKLocation52.4765.4758.2677.1377.1077.12
Organisation36.2024.8029.4442.0635.5438.53
Person61.0966.1163.5038.0755.8745.28
Overall51.7845.5648.4760.9663.9162.40
GATELocation59.6378.6367.8279.0348.1659.85
Organisation50.5821.2929.9645.0837.6841.05
Person69.5362.6765.9246.5353.7049.86
Overall61.4847.4453.5561.7246.7853.22
OpenNLPLocation76.5452.2262.0884.3445.8459.40
Organisation38.0614.8721.3959.2730.6440.39
Person83.9437.1751.5262.3441.9850.17
Overall68.6830.4442.1837.3541.7139.41
SpaCyLocation73.3875.3674.3677.0456.6465.28
Organisation40.9536.2438.4541.2036.5038.70
Person66.8956.2261.0967.4169.1468.27
Overall60.9449.0154.3366.1554.3259.66

Stanford NLP’s library is the only one that has (somewhat) high scores and blows the other libraries out of the water. The other four libraries have a roughly similar level of performance.

Note that Stanford NLP’s library performs especially well on the CoNLL 2003 dataset. This is because it comes with a classifier that was partially trained on CoNLL 2003! The scores for GMB are therefore more likely to be representative for real-world texts.

The results for Stanford NLP are similar to those from other studies. However, the accuracy for may differ as much as 66% from the values reported in existing studies. It is not clear what causes such huge discrepancies.

Summary

  1. Stanford NLP (CoreNLP) usually provides the best NER performance for English texts

Related articles