Stanford Named Entity Recognizer

author: Sabine Bartsch, Technische Universität Darmstadt

tutorial status: under revision

builds on an earlier version by Michael Hanl

1 What is the Stanford NER and what are named entities?

The Stanford Named Entity Recognizer (NER) developed by Stanford University (2002-2006) and licensed under the GNU GPL is an application which locates and classifies named entities in a text into predefined categories. Entities can be understood as elements having a distinct, separate existence. These phrases contain, for instance, the names of persons, organizations, locations, times and quantities. The detection of named entities can be useful for computational analysis of literary texts. Questions concerning the narrative structure can be answered: Which characters are introduced in which part of the text, which places are mentioned? Moreover, named entity recognition is a subtask in the field of information extraction. It is an important component if you are dealing with question answering or co-reference resolution.

This manual offers a brief introduction to the Stanford NER explaining its installation and usage.

2 Installation and Requirements

Running the application requires a Java Development Kit (JDK) version 8 or later. A free download of the Stanford NER tool is available here.

Stanford NER can be run under Windows as well as under Unix/Linux and MacOSX.

After downloading the zip archive you unzipp the file to a directory of your choice. The package contains a simple GUI (graphical user interface) providing a simple visualisation of the named entities. You can start the tool from the command line or just by double clicking the file ner-gui.bat (Windows) or (Linux/Unix/MacOSX) for using the GUI. The GUI is suitable for testing and demo purposes, but not for classifying larger files or several files.

The tool is well documented. Besides the readme file downloaded with the application and offering a brief introduction you can use the list of FAQ's and a presentation about named entity recognition and the Stanford NER as resources.

3 Running the Stanford NER

3.1 Add a text file

Concerning the choice of a text the application offers numerous opportunities. After starting the tool and clicking on the button file in the menu you can:

a) load a text file from your computer

b) choose a website URL or

c) type in or copy text material directly

To receive a first impression of the application you can use the given text sample by just clicking the button RUN NER at the bottom of the interface.

3.2 Choose a classifier

For detection of the named entities four different classifiers are offered. Based on statistical and lexical pieces of information they can be selected by the button classifiers according to your research question. The following bar shows the underlying entities:

File and underlying Entities Person Location Organization MISC DSF
ner-eng-ie.crf-3-all2008.ser.gz + + + - -
ner-eng-ie.crf-4-conll.ser.gz + + + + -
ner-eng-ie.crf-3-all2008-distsim.ser.gz + + + - +
ner-eng-ie.crf-4-conll-distsim.ser.gz + + + + +

Table 1: Features of the different classifiers

Using model 3 (file ner-eng-ie.crf-3-all2008.ser.gz) means searching for the entities: person, location and organization whereas model 4 (file ner-eng-ie.crf-4-conll.ser.gz), in addition to the three entities mentioned before, contains the entity MISC. This term - an abbreviation for miscellaneous - refers to entities that don't belong to the previous three groups, for instance, nationalities. Furthermore, these two models are offered containing additional statistical features, the distributional similarity features (DSF) (file ner-eng-ie.crf-3-all2008-distsim.ser.gz and ner-eng-ie.crf-4-conll-distsim.ser.gz). Although their selection means having results with a better performance their usage also requires more memory.

For a first attempt and a quick usage you can use the option Load Default-CRF, which means using model 3 with the entities person, location and organization.

3.3 Generating Output

The entities detected by the classifier are highlighted in different colors shown in the following figure:

Screenshot 1: Stanford NER output example

Unfortunately, the results cannot be saved in this colored format. After saving the tagged file (as *.txt file or *.gz file) the results are presented in the following manner similar to xml when opening the file again: “Then a man from <LOCATION>Belfast<LOCATION> bought the field […]”.

The application offers detection and visualization of named entities but no statistics. A possibility is a deeper analysis of the data by a concordance program such as WConcord. Thereby you can search, for instance, for the different entities. This can be useful especially when using larger amount of texts to preserve clarity. The following figure shows the results searching for the entity location in the NER output by applying WConcord.

<p align=“center”><img width=“679” alt=“StanfordNER” src=“” height=“199” border=“0” /></p>

<p align=“center”> Screenshot 1: Results of a search for entity location applying WConcord </p>

4 Summary

Besides its compatibility with other tools provided by Stanford University an advantage of the Stanford NER is the fast generation of results. Furthermore, it is language independent which means numerous possibilities for application. The performance ranges between 60-70% applying the tool on German texts. Using the models with the additional distributional similarity features the performance can be up to 77%. Concerning English texts, the value ranges between 90-93% with or without distributional similarity features (Spanish texts 80%, Dutch 70-80%). Because of the fact that the application is trained on British news texts (2002-2003) the results for other text types such as literary texts or older texts may differ.

A feature providing a possibility for manual correction of results is missing which can be seen as a disadvantage. An alternative is the usage of WordFreak-OpenNLP][Word Freak because the implementation of the Open NLP Tools in Word Freak allows named entity recognition and manual annotations.

Furthermore, you have the possibility to train the Stanford NER. This complex task requires a lot of memory and further knowledge. Useful pieces of information can be found in the FAQ.

For a deeper analysis combined with other tools for text analysis, there is the Stanford NER UIMA annotator which uses a modified version of Stanford NER. Developed by Florian Law you can download it here.

All in all, the Stanford NER offers a fast solution for automatic detection and visualization of named entities, which you can achieve easily.


%BIBTEX{topic=“LinguisticsReferences” select=“keywords : 'StanfordNER'” sort=“author” rev=“off” errors=“off”}%

1 Compatible means that the output of the Stanford NER can be used as input for further analysis as tagging and parsing which is useful for building a processing pipeline.