# BERT model correct error character with mask feature
实在抱歉,之前做项目比较急,然后没有完全上传完文件,导致大家使用受阻,现已更新
有人提醒缺少模型,近期空闲,特意将[bert模型](https://pan.baidu.com/s/1VIBfl0wbOIsKaO7FAfR1Zg)奉上,提取码为:hhxx
另外其中缺少得文件也有上传,安心食用。
# 另 实体识别纠错,ner_for_corrector
实体识别纠错的效果还可以,见[代码](https://github.com/tongchangD/ner_for_corrector),,详情介绍见[地址](https://blog.csdn.net/tcd1112/article/details/107363262)
## Bert 使用说明
1. 保存预训练模型在data文件夹下
├── data
│ ├── bert_config.json
│ ├── config.json
│ ├── pytorch_model.bin
│ └── vocab.txt
├── bert_corrector.py
├── config.py
├── logger.py
├── predict_mask.py
├── README.md
└── text_utils.py
2. 运行`bert_corrector.py`可以进行纠错。
```
python bert_corrector.py
```
3. 运行'predict_mask.py' 可以直接观测用[mask] 掩盖的地方可能出现的汉字
'''
python predict_mask.py
'''
4. 评估
通用数据下训练的结果并不适用于垂直领域的纠错,需要重新训练
```
export CUDA_VISIBLE_DEVICES=0
python run_lm_finetuning.py \
--output_dir=chinese_finetuned_lm \
--model_type=bert \
--model_name_or_path=bert-base-chinese \
--do_train \
--train_data_file=$TRAIN_FILE \
--do_eval \
--eval_data_file=$TEST_FILE \
--mlm
--num_train_epochs=3
```
或者使用
```
python -m run_lm_finetuning \
--bert_model bert-base-uncased \
--do_lower_case \
--do_train \
--train_file ./samples/sample_text.txt \
--output_dir ./samples/samples_out \
--num_train_epochs 5.0 \
--learning_rate 3e-5 \
--train_batch_size 16 \
--max_seq_length 128
```
参数可根据机器设备进行删改
没有合适的资源?快使用搜索试试~ 我知道了~
基于bert进行中文文本纠错python源码+模型+项目说明.zip
共28个文件
py:16个
txt:10个
md:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 67 浏览量
2024-05-09
19:23:34
上传
评论
收藏 16.85MB ZIP 举报
温馨提示
基于bert进行中文文本纠错python源码+模型+项目说明.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于bert进行中文文本纠错python源码+模型+项目说明.zip (28个子文件)
code
bert_corrector.py 4KB
langconv.py 8KB
data
place_name.txt 669KB
person_name.txt 173KB
word_freq.txt 8.74MB
custom_word_freq.txt 492B
same_stroke.txt 7KB
custom_confusion.txt 26KB
same_pinyin.txt 197KB
common_char_set.txt 17KB
stopwords.txt 10KB
bert_models
chinese_finetuned_lm
kenlm
people_chars_lm.klm 20.1MB
text_utils.py 5KB
detector.py 17KB
predict_mask.py 1KB
utils
zh_wiki.py 148KB
tokenizer.py 3KB
langconv.py 8KB
text_utils.py 5KB
get_file.py 13KB
logger.py 1KB
math_utils.py 2KB
run_lm_finetuning.py 28KB
requirements.txt 84B
logger.py 1KB
README.md 2KB
corrector.py 11KB
config.py 2KB
共 28 条
- 1
资源评论
熬夜写代码的平头哥
- 粉丝: 3669
- 资源: 7351
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MATLAB(GUI)的音频处理系统
- 基于 STM32 的微型调度器
- 基于STM32微控制器的PWM电机速度控制
- 基于Springboot+Vue的图书馆管理系统源码+数据库(高分毕设)
- Lesson 1.机器学习基本概念与建模流程(1).ipynb
- 一个基于 React、Dva、DataV、ECharts 框架的大数据可视化平台 支持数据动态刷新渲染、屏幕适配
- 基于Springboot+Vue的房屋租赁管理系统源码+数据库(高分毕设)
- WordPress响应式简约博客主题Alt-Blog主题
- 基于Springboot+Vue的房屋租赁管理系统源码+数据库+PPT介绍(高分毕业设计)
- 46核心知识点四十六: H(z)零极点与系统因果稳定性(8772342).vip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功