Code Monkey home page Code Monkey logo

spanner's Introduction

SpanNER: Named EntityRe-/Recognition as Span Prediction

Overview | Demo | Installation | Preprocessing | Prepare Models | Running | System Combination | Bib

This repository contains the code for our paper SpanNER: Named EntityRe-/Recognition as Span Prediction (ACL 2021).

The model designed in this work has been deployed into ExplainaBoard.

Overview

We investigate complementary advantages of systems based on different paradigms: span prediction model and sequence labeling framework. We then reveal that span prediction, simultaneously, can serve as a system combiner to re-recognize named entities from different systems’ outputs. We experimentally implement 154 systems on 11 datasets, covering three languages. Comprehensive results show the effectiveness of span prediction models that serve as base NER systems and system combiners.

d

Demo

We deploy SpanNER into the ExplainaBoard.

Quick Installation

  • python3
  • PyTorch
  • pytorch-lightning

Run the following script to install the dependencies,

pip3 install -r requirements.txt

Data Preprocessing

The dataset needs to be preprocessed, before running the model. We provide dataprocess/bio2spannerformat.py for reference, which gives the CoNLL-2003 as an example. First, you need to download datasets, and then convert them into BIO2 tagging format. We provided the CoNLL-2003 dataset with BIO format in the data/conll03_bio folder and its preprocessed format dataset in the data/conll03 folder.

The download links of the datasets used in this work are shown as follows:

Prepare Models

For English Datasets, we use BERT-Large.

For Dutch and Spanish Datasets, we use BERT-Multilingual-Base.

How to Run?

Here, we give CoNLL-2003 as an example. You may need to change the DATA_DIR, PRETRAINED, dataname, and n_class to your own dataset path, pre-trained model path, dataset name, and the number of labels in the dataset, respectively.

./run_conll03_spanner.sh

System Combination

Base Model

We provided 12 base models (result-files) of the CoNLL-2003 dataset in combination/results. More base models (result-files) can be downloaded from ExplainaBoard-download.

Combination

Put your different base models (result-files) in the data/results folder, then run:

python comb_voting.py

Here, we provided four system combination methods, including:

  • SpanNER,
  • Majority voting (VM),
  • Weighted voting based on overall F1-score (VOF1),
  • Weighted voting based on class F1-score (VCF1).

Results at a Glance

d

Bib

@article{fu2021spanner,
  title={SpanNer: Named Entity Re-/Recognition as Span Prediction},
  author={Fu, Jinlan and Huang, Xuanjing and Liu, Pengfei},
  journal={arXiv preprint arXiv:2106.00641},
  year={2021}
}

spanner's People

Contributors

jinlanfu avatar pfliu-nlp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.