wangwang110/CSC

ChineseBert用于中文拼写纠错

43

stars

56

commits

Python

primary language

Mar 14, 2023

updated

Browse cluster: Chinese Spelling Error Correction

README

CSC

中文拼写纠错

本项目只关注Chinese Spelling Check (CSC),不考虑多字少字的语法纠错。

关于语法纠错可参考 https://github.com/HillZhang1999/MuCGEC

常用数据来源:

SIGHAN Bake-off 2013: http://ir.itc.ntnu.edu.tw/lre/sighan7csc.html

SIGHAN Bake-off 2014: http://ir.itc.ntnu.edu.tw/lre/clp14csc.html

SIGHAN Bake-off 2015: http://ir.itc.ntnu.edu.tw/lre/sighan8csc.html

Wang271K: https://github.com/wdimmy/Automatic-Corpus-Generation/tree/master/corpus

sighan13,sighan14,sighan15 包含对应的训练集和测试集,Wang271K是论文利用OCR以及语音识别的方法生成的数据构,仅仅用来训练

评价指标

使用句子级纠正F1值。

关于句子级别纠正P值,有两种计算方式

  1. 分母不考虑修改了原句但是与正确句子不同的情况
  2. 分母考虑修改了原句但是与正确句子不同的情况

使用第一种计算方式得到的结果偏高,这里采用第2种

代码

该指标更为严格(所有修正过的句子都算作P值的分母),论文大都使用该评价指标

榜单

各论文指标(不同的论文使用bert取得的结果不一样,可能是使用的预训练数据不一样或者超参数的设置不同)

sighan13结果:

模型Detection LevelCorrection Level来源
Hybrid54.0 69.3 60.7_ _ 52.1A Hybrid Approach to Automatic Corpus Generation for Chinese Spelling Check
FASpell76.2 63.2 69.173.1 60.5 66.2FASPell: A Fast, Adaptable, Simple, Powerful Chinese Spell Checker Based On DAE-Decoder Paradigm
Google BERT79.0 72.8 75.877.7 71.6 74.6SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
SpellGCN80.1 74.4 77.278.3 72.7 75.4SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
HeadFilt100.0 74.9 85.7100.0 74.1 85.1Domain-shift Conditioning using Adaptable Filtering via Hierarchical Embeddings for Robust Chinese Spell Check
Chunk-based CSC61.19 75.67 67.6674.34 67.20 70.59Chunk-based Chinese Spelling Check with Global Optimization
BERT + Pre-trained for CSC- - 84.9- - 84.4Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
BERT + Adversarial training- - 84.0- - 83.5Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
SpellGCN+85.7 78.8 82.184.6 77.8 81.0Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
BERT-wwm85.0 77.0 80.883.0 75.2 78.9Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
REALISE (BERT-wwm )88.6 82.5 85.4887.2 81.2 84.1Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
BERT_CRS84.8 79.5 82.183.9 78.7 81.2Global Attention Decoder for Chinese Spelling Error Correction
BERT_CRS_GAD85.7 79.5 82.584.9 78.7 81.6Global Attention Decoder for Chinese Spelling Error Correction
ERNIE76.6 71.9 74.273.0 68.5 70.6Correcting Chinese Spelling Errors with Phonetic Pre-training
MLM-phonetics82.0 78.3 80.179.5 77.0 78.2Correcting Chinese Spelling Errors with Phonetic Pre-training
RoBERTa85.4 77.7 81.383.9 76.4 79.9Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-DCN86.2 78.4 82.184.6 76.9 80.5Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-Pretrain-DCN86.8 79.6 83.084.7 77.7 81.0Dynamic Connected Networks for Chinese Spelling Check
Google BERT98.7 70.6 82.398.6 67.8 80.4PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
PHMOSpell99.5 76.8 86.799.5 75.1 85.6PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
ECOPO BERT-wwm87.2 81.7 84.486.1 80.6 83.3The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
ECOPO REALISE (BERT-wwm )89.3 83.2 86.288.5 82.0 85.1The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
Google BERT79.0 72.8 75.877.7 71.6 74.6MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
MDCSpell89.1 78.3 83.487.5 76.8 81.8MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
Soft-Masked BERT81.1 75.7 78.375.1 70.1 72.5Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (Soft-Masked BERT)84.7 77.0 80.780.9 74.5 77.6Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
Google BERT98.7 70.6 82.398.6 67.8 80.4Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (BERT)99.1 74.8 85.399.1 73.2 84.2Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
MacBERT98.7 70.8 82.598.6 67.9 80.4Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (MacBERT)99.3 75.7 85.999.2 73.8 84.6Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
uChecker75.4 73.4 74.472.6 70.8 71.7uChecker: Masked Pretrained Language Models as Unsupervised Chinese Spelling Checkers
Google BERT85.0 77.0 80.883.0 75.2 78.9Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
LEAD88.3 83.4 85.887.2 82.4 84.7Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
SCOPE(ChineseBert)87.4 83.4 85.486.3 82.4 84.3Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SCOPE(REALISE)87.5 83.2 85.386.4 82.3 84.3Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SDCL88.9 81.8 85.288.0 81.0 84.3SDCL: Self-Distillation Contrastive Learning for Chinese Spell Checking
InfoKNN-CSC89.7 82.8 86.182.1 88.7 81.9 85.2Chinese Spelling Check with Nearest Neighbors

sighan14结果:

模型Detection LevelCorrection Level来源
Hybrid51.9 66.2 58.2_ _ 56.1A Hybrid Approach to Automatic Corpus Generation for Chinese Spelling Check
FASpell61.0 53.5 57.059.4 52.0 55.4FASPell: A Fast, Adaptable, Simple, Powerful Chinese Spell Checker Based On DAE-Decoder Paradigm
Google BERT65.6 68.1 66.863.1 65.5 64.3SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
SpellGCN65.1 69.5 67.263.1 67.2 65.3SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
HeadFilt82.5 61.6 70.582.1 60.2 69.4Domain-shift Conditioning using Adaptable Filtering via Hierarchical Embeddings for Robust Chinese Spell Check
Chunk-based CSC78.65 54.80 64.5977.43 51.04 61.52Chunk-based Chinese Spelling Check with Global Optimization
BERT + Pre-trained for CSC- - 70.4- - 68.6Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
BERT + Adversarial training- - 68.4- - 66.8Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
BERT-wwm64.5 68.6 66.562.4 66.3 64.3Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
REALISE (BERT-wwm )67.8 71.5 69.666.3 70.0 68.1Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
BERT_CRS65.4 72.7 68.963.4 70.4 66.7Global Attention Decoder for Chinese Spelling Error Correction
BERT_CRS_GAD66.6 71.8 69.165.0 70.1 67.5Global Attention Decoder for Chinese Spelling Error Correction
ERNIE63.5 69.3 66.360.1 65.6 62.8Correcting Chinese Spelling Errors with Phonetic Pre-training
MLM-phonetics66.2 73.8 69.864.2 73.8 68.7Correcting Chinese Spelling Errors with Phonetic Pre-training
RoBERTa64.2 68.4 66.262.7 66.7 64.6Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-DCN67.6 68.6 68.064.9 65.9 65.4Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-Pretrain-DCN67.4 70.4 68.965.8 68.7 67.2Dynamic Connected Networks for Chinese Spelling Check
Google BERT78.6 60.7 68.577.8 57.6 66.2PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
PHMOSpell85.3 67.6 75.584.7 64.3 73.1PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
Google BERT(4 layer)82.6 59.0 68.882.4 58.0 68.1SpellBERT: A Lightweight Pretrained Model for Chinese Spelling Check
SpellBERT (4 layer)83.1 62.0 71.082.9 61.2 70.4SpellBERT: A Lightweight Pretrained Model for Chinese Spelling Check
ECOPO BERT-wwm65.8 69.0 67.463.7 66.9 65.3The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
ECOPO REALISE (BERT-wwm )68.8 72.1 70.467.5 71.0 69.2The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
Google BERT65.6 68.1 66.863.1 65.5 64.3MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
MDCSpell70.2 68.8 69.569.0 67.7 68.3MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
Soft-Masked BERT65.2 70.4 67.763.7 68.7 66.1Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (Soft-Masked BERT)68.4 70.9 69.667.8 69.1 68.4Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
Google BERT78.6 60.7 68.577.8 57.6 66.2Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (BERT)79.2 61.6 69.378.5 60.8 68.5Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
MacBERT78.8 61.0 68.878.0 58.0 66.5Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (MacBERT)79.7 62.4 70.079.0 61.4 69.1Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
uChecker61.7 61.5 61.657.6 57.5 57.6uChecker: Masked Pretrained Language Models as Unsupervised Chinese Spelling Checkers
Google BERT64.5 68.6 66.562.4 66.3 64.3Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
LEAD70.7 71.0 70.869.3 69.6 69.5Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
SCOPE(ChineseBert)70.1 73.1 71.668.6 71.5 70.1Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SCOPE(REALISE)69.0 75.0 71.967.1 72.9 69.9Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SDCL69.7 70.3 70.070.2 67.5 68.8SDCL: Self-Distillation Contrastive Learning for Chinese Spell Checking
InfoKNN-CSC72.1 70.6 71.371.3 69.8 70.6Chinese Spelling Check with Nearest Neighbors

sighan15结果:

模型Detection LevelCorrection Level来源
Hybrid56.6 69.4 62.3_ _ 57.1A Hybrid Approach to Automatic Corpus Generation for Chinese Spelling Check
FASpell67.6 60.0 63.566.6 59.1 62.6FASPell: A Fast, Adaptable, Simple, Powerful Chinese Spell Checker Based On DAE-Decoder Paradigm
Google BERT73.7 78.2 75.970.9 75.2 73.0SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
SpellGCN74.8 80.7 77.772.1 77.7 75.9SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
Google BERT73.0 70.8 71.965.9 64.0 64.9Spelling Error Correction with Soft-Masked BERT
Soft-Masked BERT73.7 73.2 73.566.7 66.2 66.4Spelling Error Correction with Soft-Masked BERT
HeadFilt84.5 71.8 77.684.2 70.2 76.5Domain-shift Conditioning using Adaptable Filtering via Hierarchical Embeddings for Robust Chinese Spell Check
Chunk-based CSC88.11 62.00 72.7987.33 57.64 69.44Chunk-based Chinese Spelling Check with Global Optimization
BERT + Pre-trained for CSC- - 79.8- - 78.0Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
BERT + Adversarial training- - 80.0- - 78.2Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
BERT-wwm74.2 78.0 76.171.6 75.3 73.4Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
REALISE (BERT-wwm)77.3 81.3 79.375.9 79.9 77.8Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
BERT_CRS74.0 80.2 77.272.2 77.8 74.8Global Attention Decoder for Chinese Spelling Error Correction
BERT_CRS_GAD75.6 80.4 77.973.2 77.8 75.4Global Attention Decoder for Chinese Spelling Error Correction
ERNIE73.6 79.8 76.668.6 74.4 71.4Correcting Chinese Spelling Errors with Phonetic Pre-training
MLM-phonetics77.5 83.1 80.274.9 80.2 77.5Correcting Chinese Spelling Errors with Phonetic Pre-training
RoBERTa74.7 77.3 76.072.1 74.5 73.3Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-DCN76.6 79.8 78.274.2 77.3 75.7Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-Pretrain-DCN77.1 80.9 79.074.5 78.2 76.3Dynamic Connected Networks for Chinese Spelling Check
Google BERT68.4 77.6 72.766.0 74.9 70.2PLOME: Pre-training with Misspelled Knowledge for Chinese Spelling Correction
PLOME77.4 81.5 79.475.3 79.3 77.2PLOME: Pre-training with Misspelled Knowledge for Chinese Spelling Correction
Google BERT79.9 84.1 72.9 78.183.1 68.0 74.8PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
PHMOSpell90.1 72.7 80.589.6 69.2 78.1PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
Soft-Masked BERT SSCL86.34 72.46 78.7985.20 65.99 74.38Self-Supervised Curriculum Learning for Spelling Error Correction
Google BERT(4 layer)85.2 68.9 76.284.8 66.9 74.8SpellBERT: A Lightweight Pretrained Model for Chinese Spelling Check
SpellBERT (4 layer)87.5 73.6 80.087.1 71.5 78.5SpellBERT: A Lightweight Pretrained Model for Chinese Spelling Check
ECOPO BERT-wwm78.2 82.3 80.276.6 80.4 78.4The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
ECOPO REALISE (BERT-wwm)77.5 82.6 80.076.1 81.2 78.5The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
Google BERT73.7 78.2 75.970.9 75.2 73.0MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
MDCSpell80.8 80.6 80.778.4 78.2 78.3MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
Google BERT76.0 81.0 78.474.7 79.5 77.0General and Domain Adaptive Chinese Spelling Check with Error Consistent Pretraining
ECSpell81.1 83.0 81.077.5 81.7 79.5General and Domain Adaptive Chinese Spelling Check with Error Consistent Pretraining
Soft-Masked BERT73.7 73.2 73.566.7 66.2 66.4Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (Soft-Masked BERT)83.5 74.8 78.979.9 72.1 75.8Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
Google BERT84.1 72.9 78.183.1 68.0 74.8Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (BERT)85.0 74.5 79.484.2 72.3 77.8Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
MacBERT84.3 73.1 78.383.3 68.2 75.0Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (MacBERT)85.8 75.4 80.384.7 73.0 78.4Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
uChecker75.4 72.0 73.770.6 67.3 68.9uChecker: Masked Pretrained Language Models as Unsupervised Chinese Spelling Checkers
Google BERT74.2 78.0 76.171.6 75.3 73.4Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
LEAD79.2 82.8 80.977.6 81.2 79.3Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
SCOPE(ChineseBert)81.1 84.3 82.779.2 82.3 80.7Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SCOPE(REALISE)78.7 84.7 81.676.8 82.6 79.6Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SDCL81.2 79.1 80.179.3 77.5 78.3SDCL: Self-Distillation Contrastive Learning for Chinese Spell Checking
InfoKNN-CSC81.2 81.2 81.280.0 80.0 80.0Chinese Spelling Check with Nearest Neighbors
Google BERT74.2 78.0 76.171.6 75.3 73.4An Error-Guided Correction Model for Chinese Spelling Error Correction
EGCM82.7 77.6 80.080.6 74.7 77.5An Error-Guided Correction Model for Chinese Spelling Error Correction
Pre-Tn EGCM83.4 79.8 81.681.4 78.4 79.9An Error-Guided Correction Model for Chinese Spelling Error Correction

香侬科技ChineseBert用于中文拼写纠错

ChineseBert repo[https://github.com/ShannonAI/ChineseBert]

image

  • 训练:
  1. 下载ChineseBert放出的预训练模型,放置在本地文件夹(chinese_bert_path 参数)

  2. 拷贝ChineseBert代码,置于ChineseBert文件夹,并安装ChineseBert所需依赖

  3. 运行train.sh

  • 测试:

运行eval.sh

  • 纠正文本:

填入模型路径,运行csc_eval.py 即可

运行结果:

布告栏转眼之间从不起眼的丑小鸭变成了高贵优雅的天鹅!仅管这大改造没有得名,但过程也是很可贵的。
布告栏转眼之间从不起眼的丑小鸭变成了高贵优雅的天鹅!尽管这大改造没有得名,但过程也是很可贵的。
仅->尽
我爱北进天安门
我爱北进天安门
我爱北京天按门
我爱北京天安门
按->安
没过几分钟,救护车来了,发出响亮而清翠的声音
没过几分钟,救护车来了,发出响亮而清翠的声音
我见过一望无际、波澜壮阔的大海;玩赏过水平如镜、诗情画意的西湖;游览过翡翠般的漓江;让我难以忘怀的要数那荷叶飘香、群山坏绕的普者黑。
我见过一望无际、波澜壮阔的大海;玩赏过水平如镜、诗情画意的西湖;游览过翡翠般的漓江;让我难以忘怀的要数那荷叶飘香、群山环绕的普者黑。
坏->环
  • 已经训练好的模型:

链接: https://pan.baidu.com/s/1mi0r2Uvv9rd_bfDONNDVYA?pwd=cvak

  • 指标:
数据集Detection LevelCorrection Level
sighan13p:0.84,r:0.792,F1:0.815p:0.823,recall:0.775,F1:0.799
new_datap:0.491,r:0.398,F1:0.44p:0.442,recall:0.358,F1:0.396
  • 注意
  1. 先用wang2018数据预训练,再用同分布的sighan13微调
  2. 使用词表的分词方式容易造成拼音和数字错误修正,因此直接使用一个字作为token,不使用基于词表的分词(csc_train_mlm_tok.py)

Contributors

wangwang110

56 commits

wangwang110/CSC

ChineseBert用于中文拼写纠错

43

stars

56

commits

Python

primary language

Mar 14, 2023

updated

Browse cluster: Chinese Spelling Error Correction

README

CSC

中文拼写纠错

本项目只关注Chinese Spelling Check (CSC),不考虑多字少字的语法纠错。

关于语法纠错可参考 https://github.com/HillZhang1999/MuCGEC

常用数据来源:

SIGHAN Bake-off 2013: http://ir.itc.ntnu.edu.tw/lre/sighan7csc.html

SIGHAN Bake-off 2014: http://ir.itc.ntnu.edu.tw/lre/clp14csc.html

SIGHAN Bake-off 2015: http://ir.itc.ntnu.edu.tw/lre/sighan8csc.html

Wang271K: https://github.com/wdimmy/Automatic-Corpus-Generation/tree/master/corpus

sighan13,sighan14,sighan15 包含对应的训练集和测试集,Wang271K是论文利用OCR以及语音识别的方法生成的数据构,仅仅用来训练

评价指标

使用句子级纠正F1值。

关于句子级别纠正P值,有两种计算方式

  1. 分母不考虑修改了原句但是与正确句子不同的情况
  2. 分母考虑修改了原句但是与正确句子不同的情况

使用第一种计算方式得到的结果偏高,这里采用第2种

代码

该指标更为严格(所有修正过的句子都算作P值的分母),论文大都使用该评价指标

榜单

各论文指标(不同的论文使用bert取得的结果不一样,可能是使用的预训练数据不一样或者超参数的设置不同)

sighan13结果:

模型Detection LevelCorrection Level来源
Hybrid54.0 69.3 60.7_ _ 52.1A Hybrid Approach to Automatic Corpus Generation for Chinese Spelling Check
FASpell76.2 63.2 69.173.1 60.5 66.2FASPell: A Fast, Adaptable, Simple, Powerful Chinese Spell Checker Based On DAE-Decoder Paradigm
Google BERT79.0 72.8 75.877.7 71.6 74.6SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
SpellGCN80.1 74.4 77.278.3 72.7 75.4SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
HeadFilt100.0 74.9 85.7100.0 74.1 85.1Domain-shift Conditioning using Adaptable Filtering via Hierarchical Embeddings for Robust Chinese Spell Check
Chunk-based CSC61.19 75.67 67.6674.34 67.20 70.59Chunk-based Chinese Spelling Check with Global Optimization
BERT + Pre-trained for CSC- - 84.9- - 84.4Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
BERT + Adversarial training- - 84.0- - 83.5Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
SpellGCN+85.7 78.8 82.184.6 77.8 81.0Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
BERT-wwm85.0 77.0 80.883.0 75.2 78.9Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
REALISE (BERT-wwm )88.6 82.5 85.4887.2 81.2 84.1Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
BERT_CRS84.8 79.5 82.183.9 78.7 81.2Global Attention Decoder for Chinese Spelling Error Correction
BERT_CRS_GAD85.7 79.5 82.584.9 78.7 81.6Global Attention Decoder for Chinese Spelling Error Correction
ERNIE76.6 71.9 74.273.0 68.5 70.6Correcting Chinese Spelling Errors with Phonetic Pre-training
MLM-phonetics82.0 78.3 80.179.5 77.0 78.2Correcting Chinese Spelling Errors with Phonetic Pre-training
RoBERTa85.4 77.7 81.383.9 76.4 79.9Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-DCN86.2 78.4 82.184.6 76.9 80.5Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-Pretrain-DCN86.8 79.6 83.084.7 77.7 81.0Dynamic Connected Networks for Chinese Spelling Check
Google BERT98.7 70.6 82.398.6 67.8 80.4PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
PHMOSpell99.5 76.8 86.799.5 75.1 85.6PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
ECOPO BERT-wwm87.2 81.7 84.486.1 80.6 83.3The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
ECOPO REALISE (BERT-wwm )89.3 83.2 86.288.5 82.0 85.1The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
Google BERT79.0 72.8 75.877.7 71.6 74.6MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
MDCSpell89.1 78.3 83.487.5 76.8 81.8MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
Soft-Masked BERT81.1 75.7 78.375.1 70.1 72.5Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (Soft-Masked BERT)84.7 77.0 80.780.9 74.5 77.6Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
Google BERT98.7 70.6 82.398.6 67.8 80.4Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (BERT)99.1 74.8 85.399.1 73.2 84.2Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
MacBERT98.7 70.8 82.598.6 67.9 80.4Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (MacBERT)99.3 75.7 85.999.2 73.8 84.6Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
uChecker75.4 73.4 74.472.6 70.8 71.7uChecker: Masked Pretrained Language Models as Unsupervised Chinese Spelling Checkers
Google BERT85.0 77.0 80.883.0 75.2 78.9Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
LEAD88.3 83.4 85.887.2 82.4 84.7Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
SCOPE(ChineseBert)87.4 83.4 85.486.3 82.4 84.3Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SCOPE(REALISE)87.5 83.2 85.386.4 82.3 84.3Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SDCL88.9 81.8 85.288.0 81.0 84.3SDCL: Self-Distillation Contrastive Learning for Chinese Spell Checking
InfoKNN-CSC89.7 82.8 86.182.1 88.7 81.9 85.2Chinese Spelling Check with Nearest Neighbors

sighan14结果:

模型Detection LevelCorrection Level来源
Hybrid51.9 66.2 58.2_ _ 56.1A Hybrid Approach to Automatic Corpus Generation for Chinese Spelling Check
FASpell61.0 53.5 57.059.4 52.0 55.4FASPell: A Fast, Adaptable, Simple, Powerful Chinese Spell Checker Based On DAE-Decoder Paradigm
Google BERT65.6 68.1 66.863.1 65.5 64.3SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
SpellGCN65.1 69.5 67.263.1 67.2 65.3SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
HeadFilt82.5 61.6 70.582.1 60.2 69.4Domain-shift Conditioning using Adaptable Filtering via Hierarchical Embeddings for Robust Chinese Spell Check
Chunk-based CSC78.65 54.80 64.5977.43 51.04 61.52Chunk-based Chinese Spelling Check with Global Optimization
BERT + Pre-trained for CSC- - 70.4- - 68.6Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
BERT + Adversarial training- - 68.4- - 66.8Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
BERT-wwm64.5 68.6 66.562.4 66.3 64.3Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
REALISE (BERT-wwm )67.8 71.5 69.666.3 70.0 68.1Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
BERT_CRS65.4 72.7 68.963.4 70.4 66.7Global Attention Decoder for Chinese Spelling Error Correction
BERT_CRS_GAD66.6 71.8 69.165.0 70.1 67.5Global Attention Decoder for Chinese Spelling Error Correction
ERNIE63.5 69.3 66.360.1 65.6 62.8Correcting Chinese Spelling Errors with Phonetic Pre-training
MLM-phonetics66.2 73.8 69.864.2 73.8 68.7Correcting Chinese Spelling Errors with Phonetic Pre-training
RoBERTa64.2 68.4 66.262.7 66.7 64.6Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-DCN67.6 68.6 68.064.9 65.9 65.4Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-Pretrain-DCN67.4 70.4 68.965.8 68.7 67.2Dynamic Connected Networks for Chinese Spelling Check
Google BERT78.6 60.7 68.577.8 57.6 66.2PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
PHMOSpell85.3 67.6 75.584.7 64.3 73.1PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
Google BERT(4 layer)82.6 59.0 68.882.4 58.0 68.1SpellBERT: A Lightweight Pretrained Model for Chinese Spelling Check
SpellBERT (4 layer)83.1 62.0 71.082.9 61.2 70.4SpellBERT: A Lightweight Pretrained Model for Chinese Spelling Check
ECOPO BERT-wwm65.8 69.0 67.463.7 66.9 65.3The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
ECOPO REALISE (BERT-wwm )68.8 72.1 70.467.5 71.0 69.2The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
Google BERT65.6 68.1 66.863.1 65.5 64.3MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
MDCSpell70.2 68.8 69.569.0 67.7 68.3MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
Soft-Masked BERT65.2 70.4 67.763.7 68.7 66.1Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (Soft-Masked BERT)68.4 70.9 69.667.8 69.1 68.4Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
Google BERT78.6 60.7 68.577.8 57.6 66.2Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (BERT)79.2 61.6 69.378.5 60.8 68.5Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
MacBERT78.8 61.0 68.878.0 58.0 66.5Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (MacBERT)79.7 62.4 70.079.0 61.4 69.1Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
uChecker61.7 61.5 61.657.6 57.5 57.6uChecker: Masked Pretrained Language Models as Unsupervised Chinese Spelling Checkers
Google BERT64.5 68.6 66.562.4 66.3 64.3Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
LEAD70.7 71.0 70.869.3 69.6 69.5Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
SCOPE(ChineseBert)70.1 73.1 71.668.6 71.5 70.1Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SCOPE(REALISE)69.0 75.0 71.967.1 72.9 69.9Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SDCL69.7 70.3 70.070.2 67.5 68.8SDCL: Self-Distillation Contrastive Learning for Chinese Spell Checking
InfoKNN-CSC72.1 70.6 71.371.3 69.8 70.6Chinese Spelling Check with Nearest Neighbors

sighan15结果:

模型Detection LevelCorrection Level来源
Hybrid56.6 69.4 62.3_ _ 57.1A Hybrid Approach to Automatic Corpus Generation for Chinese Spelling Check
FASpell67.6 60.0 63.566.6 59.1 62.6FASPell: A Fast, Adaptable, Simple, Powerful Chinese Spell Checker Based On DAE-Decoder Paradigm
Google BERT73.7 78.2 75.970.9 75.2 73.0SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
SpellGCN74.8 80.7 77.772.1 77.7 75.9SpellGCN: Incorporating Phonological and Visual Similarities into Language Models for Chinese Spelling Check
Google BERT73.0 70.8 71.965.9 64.0 64.9Spelling Error Correction with Soft-Masked BERT
Soft-Masked BERT73.7 73.2 73.566.7 66.2 66.4Spelling Error Correction with Soft-Masked BERT
HeadFilt84.5 71.8 77.684.2 70.2 76.5Domain-shift Conditioning using Adaptable Filtering via Hierarchical Embeddings for Robust Chinese Spell Check
Chunk-based CSC88.11 62.00 72.7987.33 57.64 69.44Chunk-based Chinese Spelling Check with Global Optimization
BERT + Pre-trained for CSC- - 79.8- - 78.0Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
BERT + Adversarial training- - 80.0- - 78.2Exploration and Exploitation: Two Ways to Improve Chinese Spelling Correction Models
BERT-wwm74.2 78.0 76.171.6 75.3 73.4Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
REALISE (BERT-wwm)77.3 81.3 79.375.9 79.9 77.8Read, Listen, and See: Leveraging Multimodal Information Helps Chinese Spell Checking
BERT_CRS74.0 80.2 77.272.2 77.8 74.8Global Attention Decoder for Chinese Spelling Error Correction
BERT_CRS_GAD75.6 80.4 77.973.2 77.8 75.4Global Attention Decoder for Chinese Spelling Error Correction
ERNIE73.6 79.8 76.668.6 74.4 71.4Correcting Chinese Spelling Errors with Phonetic Pre-training
MLM-phonetics77.5 83.1 80.274.9 80.2 77.5Correcting Chinese Spelling Errors with Phonetic Pre-training
RoBERTa74.7 77.3 76.072.1 74.5 73.3Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-DCN76.6 79.8 78.274.2 77.3 75.7Dynamic Connected Networks for Chinese Spelling Check
RoBERTa-Pretrain-DCN77.1 80.9 79.074.5 78.2 76.3Dynamic Connected Networks for Chinese Spelling Check
Google BERT68.4 77.6 72.766.0 74.9 70.2PLOME: Pre-training with Misspelled Knowledge for Chinese Spelling Correction
PLOME77.4 81.5 79.475.3 79.3 77.2PLOME: Pre-training with Misspelled Knowledge for Chinese Spelling Correction
Google BERT79.9 84.1 72.9 78.183.1 68.0 74.8PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
PHMOSpell90.1 72.7 80.589.6 69.2 78.1PHMOSpell: Phonological and Morphological Knowledge Guided Chinese Spelling Check
Soft-Masked BERT SSCL86.34 72.46 78.7985.20 65.99 74.38Self-Supervised Curriculum Learning for Spelling Error Correction
Google BERT(4 layer)85.2 68.9 76.284.8 66.9 74.8SpellBERT: A Lightweight Pretrained Model for Chinese Spelling Check
SpellBERT (4 layer)87.5 73.6 80.087.1 71.5 78.5SpellBERT: A Lightweight Pretrained Model for Chinese Spelling Check
ECOPO BERT-wwm78.2 82.3 80.276.6 80.4 78.4The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
ECOPO REALISE (BERT-wwm)77.5 82.6 80.076.1 81.2 78.5The Past Mistake is the Future Wisdom: Error-driven Contrastive Probability Optimization for Chinese Spell Checking
Google BERT73.7 78.2 75.970.9 75.2 73.0MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
MDCSpell80.8 80.6 80.778.4 78.2 78.3MDCSpell: A Multi-task Detector-Corrector Framework for Chinese Spelling Correction
Google BERT76.0 81.0 78.474.7 79.5 77.0General and Domain Adaptive Chinese Spelling Check with Error Consistent Pretraining
ECSpell81.1 83.0 81.077.5 81.7 79.5General and Domain Adaptive Chinese Spelling Check with Error Consistent Pretraining
Soft-Masked BERT73.7 73.2 73.566.7 66.2 66.4Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (Soft-Masked BERT)83.5 74.8 78.979.9 72.1 75.8Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
Google BERT84.1 72.9 78.183.1 68.0 74.8Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (BERT)85.0 74.5 79.484.2 72.3 77.8Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
MacBERT84.3 73.1 78.383.3 68.2 75.0Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
CL (MacBERT)85.8 75.4 80.384.7 73.0 78.4Contextual Similarity is More Valuable than Character Similarity: An Empirical Study for Chinese Spell Checking
uChecker75.4 72.0 73.770.6 67.3 68.9uChecker: Masked Pretrained Language Models as Unsupervised Chinese Spelling Checkers
Google BERT74.2 78.0 76.171.6 75.3 73.4Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
LEAD79.2 82.8 80.977.6 81.2 79.3Learning from the Dictionary: Heterogeneous Knowledge Guided Fine-tuning for Chinese Spell Checking
SCOPE(ChineseBert)81.1 84.3 82.779.2 82.3 80.7Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SCOPE(REALISE)78.7 84.7 81.676.8 82.6 79.6Improving Chinese Spelling Check by Character Pronunciation Prediction: The Effects of Adaptivity and Granularity
SDCL81.2 79.1 80.179.3 77.5 78.3SDCL: Self-Distillation Contrastive Learning for Chinese Spell Checking
InfoKNN-CSC81.2 81.2 81.280.0 80.0 80.0Chinese Spelling Check with Nearest Neighbors
Google BERT74.2 78.0 76.171.6 75.3 73.4An Error-Guided Correction Model for Chinese Spelling Error Correction
EGCM82.7 77.6 80.080.6 74.7 77.5An Error-Guided Correction Model for Chinese Spelling Error Correction
Pre-Tn EGCM83.4 79.8 81.681.4 78.4 79.9An Error-Guided Correction Model for Chinese Spelling Error Correction

香侬科技ChineseBert用于中文拼写纠错

ChineseBert repo[https://github.com/ShannonAI/ChineseBert]

image

  • 训练:
  1. 下载ChineseBert放出的预训练模型,放置在本地文件夹(chinese_bert_path 参数)

  2. 拷贝ChineseBert代码,置于ChineseBert文件夹,并安装ChineseBert所需依赖

  3. 运行train.sh

  • 测试:

运行eval.sh

  • 纠正文本:

填入模型路径,运行csc_eval.py 即可

运行结果:

布告栏转眼之间从不起眼的丑小鸭变成了高贵优雅的天鹅!仅管这大改造没有得名,但过程也是很可贵的。
布告栏转眼之间从不起眼的丑小鸭变成了高贵优雅的天鹅!尽管这大改造没有得名,但过程也是很可贵的。
仅->尽
我爱北进天安门
我爱北进天安门
我爱北京天按门
我爱北京天安门
按->安
没过几分钟,救护车来了,发出响亮而清翠的声音
没过几分钟,救护车来了,发出响亮而清翠的声音
我见过一望无际、波澜壮阔的大海;玩赏过水平如镜、诗情画意的西湖;游览过翡翠般的漓江;让我难以忘怀的要数那荷叶飘香、群山坏绕的普者黑。
我见过一望无际、波澜壮阔的大海;玩赏过水平如镜、诗情画意的西湖;游览过翡翠般的漓江;让我难以忘怀的要数那荷叶飘香、群山环绕的普者黑。
坏->环
  • 已经训练好的模型:

链接: https://pan.baidu.com/s/1mi0r2Uvv9rd_bfDONNDVYA?pwd=cvak

  • 指标:
数据集Detection LevelCorrection Level
sighan13p:0.84,r:0.792,F1:0.815p:0.823,recall:0.775,F1:0.799
new_datap:0.491,r:0.398,F1:0.44p:0.442,recall:0.358,F1:0.396
  • 注意
  1. 先用wang2018数据预训练,再用同分布的sighan13微调
  2. 使用词表的分词方式容易造成拼音和数字错误修正,因此直接使用一个字作为token,不使用基于词表的分词(csc_train_mlm_tok.py)

Contributors

wangwang110

56 commits

Languages

Python

98.2%

Shell

1.8%