shibing624's picture
Update README.md
bb20b28
|
raw
history blame
No virus
2.25 kB
metadata
language:
  - zh
tags:
  - bert
  - pytorch
  - zh
  - ner
license: apache-2.0

BERT for Chinese Named Entity Recognition(bert4ner) Model

中文实体识别模型

bert4ner-base-chinese evaluate PEOPLE(人民日报) test data:

The overall performance of BERT on people test:

Accuracy Recall F1
BertSoftmax 0.9425 0.9627 0.9525

在PEOPLE的测试集上达到接近SOTA水平。

BertSoftmax的网络结构(原生BERT):

arch

Usage

本项目开源在实体识别项目:nerpy,可支持bert4ner模型,通过如下命令调用:

>>> from nerpy import NERModel
>>> model = NERModel("bert", "shibing624/bert4ner-base-chinese")
>>> predictions, raw_outputs, entities = model.predict(["常建良,男,1963年出生,工科学士,高级工程师"], split_on_space=False)
entities: [('常建良', 'PER'), ('1963年', 'TIME')]

模型文件组成:

bert4ner-base-chinese
    ├── config.json
    ├── model_args.json
    ├── pytorch_model.bin
    ├── special_tokens_map.json
    ├── tokenizer_config.json
    └── vocab.txt

训练数据集

中文实体识别数据集

数据集 语料 下载链接 文件大小
CNER中文实体识别数据集 CNER(12万字) CNER github 1.1MB
PEOPLE中文实体识别数据集 人民日报数据集(200万字) PEOPLE github 12.8MB

CNER中文实体识别数据集,数据格式:

美	B-LOC
国	I-LOC
的	O
华	B-PER
莱	I-PER
士	I-PER

我	O
跟	O
他	O

如果需要训练bert4ner,请参考https://github.com/shibing624/nerpy/tree/main/examples

Citation

@software{nerpy,
  author = {Xu Ming},
  title = {nerpy: Named Entity Recognition toolkit},
  year = {2022},
  url = {https://github.com/shibing624/nerpy},
}