Ricardokevins/Bert-In-Relation-Extraction

使用Bert完成实体之间关系抽取

What it solves

This project provides a model for relation extraction, which is the task of identifying the semantic relationship between two entities mentioned in a text (e.g., identifying that "赵丽颖」 is the "主演" (lead actor) of "花千骨"). It is designed to work with the Baidu DuIE dataset, which contains 49 different types of relationships.

How it works

The model uses a BERT-based architecture for sequence classification. It concatenates the two entities and the source sentence together and feeds them into a BERT Encoder followed by a Fully Connected (FC) layer and a Cross-Entropy loss function. The implementation includes a MASK-Attention mechanism to improve performance.

Who it’s for

Developers and researchers interested in Natural Language Processing (NLP) and relation extraction, specifically those working with Chinese text and the DuIE dataset.

Highlights

  • High Accuracy: Achieves up to 95.37% accuracy on the full Baidu DuIE test set.
  • Pre-trained Models: Provides download links for pre-trained models with 92.5% and 95.37% accuracy.
  • Ready-to-use Demo: Includes a demo.py script for quick testing and sample output generation.
  • Comprehensive Dataset Support: Specifically optimized for the 49 relationship categories defined in the DuIE dataset.

Related