This example builds a bi-directional LSTM-CNN model for NER task and trains on CoNLL-2003 data. Model and training are described in
(Ma et al.) End-to-end Sequence Labeling via Bi-directional LSTM-CNNs-CRF
The top CRF layer is not used here.
The code uses CoNLL-2003 NER dataset (English). Please put data files (e.g., eng.train.bio.conll
) under ./data
folder. Pretrained Glove word embeddings can also be used (set load_glove=True
in config.py). The Glove file should also be under ./data
.
To train a NER model,
python ner.py
The model will begin training, and will evaluate on the validation data periodically, and evaluate on the test data after the training is done.
The results on validation and test data is:
prec | recall | F1 | |
---|---|---|---|
valid | 91.18 | 92.41 | 91.79 |
test | 86.13 | 88.31 | 87.21 |