NER system based on stack LSTMs
C++ CMake Python Perl
Switch branches/tags
Nothing to show
Clone or download
Latest commit 11ce11a Dec 13, 2017
Failed to load latest commit information.
cmake cmakelists.txt was missing May 30, 2016
dynet @ c28a317 Updated to DyNet Aug 15, 2017
ner-system Updated to DyNet Aug 15, 2017
.gitignore Initial commit Mar 31, 2016
.gitmodules Updated to DyNet Aug 15, 2017
CMakeLists.txt Some changes to dynet Aug 15, 2017 Updated to DyNet Aug 15, 2017 Some changes to dynet Aug 15, 2017

Transition-based NER system.

This system is part of a paper accepted at NAACL-HLT 2016 Conference. See the paper here:

Desired labeling

John Smith went to Pittsburgh .
 PER-----   O    O  LOC       O

Corresponding sequence of operations (generated by


Data structures

  • buffer - sequence of tokens, read from left to right
  • stack - working memory
  • output buffer - sequence of labeled segments constructed from left to right


  • SHIFT - move word from buffer to top of stack
  • REDUCE(X) - all words on stack are popped, combined to form a segment and labeled with X and copied to output buffer
  • OUT - move one token from buffer to output buffer

Dataset & Preprocessing

We use the datasets from conll2002 and conll2003

Convert conll format to ner action ( and convert it to parser friendly format (

   perl conll2003/train > conll2003/train.trans
   python -f conll2003/train.trans > conll2003/train.parser 

If you see that the words in the oracle have ' symbol , do the following in the trainind/test/dev datasets:

    []['Peter-NNP', 'Blackburn-NNP'] -->  [][Peter-NNP, Blackburn-NNP]

Link to the word vectors that we used in the NAACL 2016 paper for English: sskip.100.vectors.

Build the system

The first time you clone the repository, you need to sync the dynet/ submodule.

git submodule init
git submodule update

mkdir build
cd build
cmake .. -DEIGEN3_INCLUDE_DIR=/path/to/eigen
make -j2


./lstm-parse -T conll2003/train.parser -d conll2003/dev.parser --hidden_dim 100 --lstm_input_dim 100 -w sskip.100.vectors --pretrained_dim 100 --rel_dim 20 --action_dim 20 --input_dim 100 -t -S -D 0.3 > logNERYesCharNoPosYesEmbeddingsD0.3.txt &


./lstm-parse -T conll2003/train.parser -d conll2003/test.parser --hidden_dim 100 --lstm_input_dim 100 -w sskip.100.vectors --pretrained_dim 100 --rel_dim 20 --action_dim 20 --input_dim 100 -m latest_model -S > output.txt
python -p output.txt -t conll2003/test -o evaloutput.txt


Attach your prediction to test file

  python -p (prediction) -t /path/to/conll2003/test -o (output file)
  ./conlleval < (output file)


If you make use of this software, please cite the following:

  author={Guillaume Lample and Miguel Ballesteros and Kazuya Kawakami and Sandeep Subramanian and Chris Dyer},
  title={Neural Architectures for Named Entity Recognition},
  booktitle={Proc. NAACL-HLT},


This software is released under the terms of the Apache License, Version 2.0.


For questions and usage issues, please contact