Coder Social home page Coder Social logo

miner's Introduction

MINER: Mutual Information based Named Entity Recognition

This repository contains the code for our paper MINER: Improving Out-of-Vocabulary Named Entity Recognition from an Information Theoretic Perspective (ACL 2022).

Table of Contents

Overview

NER models underperform when predicting entities that have not been seen during training, which is referred to as an Out-of-Vocabulary (OOV) problem. We propose MINER, a novel NER learning framework, to remedy this is- sue from an information-theoretic perspective.

Installation

Require python version >= 3.7, recommend install with pip.

pip install -r requirements.txt

Preparation

Data Preprocessing

You need to put your data (train.txt, dev.txt, test.txt, labels.txt) in a folder . The data format refers to the CoNLL2003 dataset.

To generate new samples, we need to run the preprocessing script.

python ./scripts/cal_vocab.py --data_dir data_dir_path --tokenizer tokenizer_name

The script would output pmi.json to your data_dir , which contains important substring to prevent operations on entities when they are replaced.

python ./scripts/collect_entity.py --data_dir data_dir_path

The script would output entity.json to your data_dir , which contains entities and their neighbors.

Prepare Models

Bert, ALbert and Roberta can be applied directly as our encoders.

Training

Note that the beta and gama of different datasets and models are different, it is recommended to adjust slightly when applying other scenarios.

Here we give the parameters of Bert-base-uncased model, the performance will be further boosted when you use Bert-large. You can train and test in one click with the following commands.

# CoNLL2003
python -u main_conll.py --epoch 30 --do_train --batch_size 64 --gama 0.001 --beta 0.01 --gpu_id 0 --lr 0.00001 --switch_ratio 0.5 --data_dir data_dir_path --output_dir out_path 

# TwitterNER
python -u main.py --epoch 50 --batch_size 64 --do_train --do_eval --do_predict --gama 0.0001 --beta 0.0001 --gpu_id 0 --lr 0.00001 --switch_ratio 0.5 --data_dir data_dir_path --output_dir out_path 

# BioNER
python -u main.py --epoch 50 --batch_size 64 --do_train --do_eval --do_predict --gama 0.0001 --beta 0.001 --gpu_id 0 --lr 0.00001 --switch_ratio 0.5 --data_dir data_dir_path --output_dir out_path 

# WNUT2017
python -u main.py --epoch 50 --batch_size 64 --do_train --do_eval --do_predict --gama 0.0001 --beta 0.0001 --gpu_id 0 --lr 0.00001 --switch_ratio 0.5 --data_dir data_dir_path --output_dir out_path 

Results

Citation

If you are using MINER for your work, please kindly cite our paper:

@inproceedings{wang2022miner,
  title={MINER: Improving Out-of-Vocabulary Named Entity Recognition from an Information Theoretic Perspective},
  author={Wang, Xiao and Dou, Shihan and Xiong, Limao and Zou, Yicheng and Zhang, Qi and others},
  booktitle={Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  pages={5590--5600},
  year={2022}
}

miner's People

Contributors

warm345 avatar

Watchers

 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.