一键语法错误增强工具 ChineseErrorCorrector

一键语法错误增强工具

欢迎使用我最近开源的使用一键语法错误增强工具,该工具可以进行14种语法错误的增强,不同行业可以根据自己的数据进行错误替换,来训练自己的语法和拼写模型,希望推动行业文本纠错的发展,欢迎Star,14种错误如下所示:

每种错误类型,对应的使用方法,如下所示:

环境的安装

复制代码
pip install ChineseErrorCorrector

  

不同类型的数据增强

1.缺字漏字

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.lack_word("小明住在北京"))

# 输出:小明在北京

  

2.错别字错误

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.wrong_word("小明住在北京"))
# 输出:小明住在北鲸

3.缺少标点

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.lack_char("小明住在北京,热爱NLP。"))
# 输出:小明住在北京热爱NLP。

  

4.错用标点

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.wrong_char("小明住在北京"))
# 输出:小明住在北京。热爱NLP。

  

5.主语不明

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.unknow_sub("小明住在北京"))
# 输出:住在北京

  

6.谓语残缺

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.unknow_pred("小明住在北京"))
# 输出:小明在北京

  

7.宾语残缺

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.lack_obj("小明住在北京,热爱NLP。"))
# 输出:小明住在北京,热爱。

  

8.其他成分残缺

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.lack_others("小明住在北京,热爱NLP。"))
# 输出:小明住北京,热爱NLP。

  

9.虚词多余

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.red_fun("小明住在北京,热爱NLP。"))
# 输出:小明所住的在北京,热爱NLP。

  

10.其他成分多余

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.red_component("小明住在北京,热爱NLP。"))
# 输出:小明住在北京,热爱NLP。,看着

  

11.主语多余

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.red_sub("小明住在北京,热爱NLP。"))
# 输出:小明住在北京,小明热爱NLP。

  

12.语序不当

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.wrong_sentence_order("小明住在北京,热爱NLP。"))
# 输出:热爱NLP。,小明住在北京

  

13.动宾搭配不当

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.wrong_ver_obj("小明住在北京,热爱NLP。"))
# 输出:None ,即无法进行此类错误的增强

  

14.其他搭配不当

复制代码
from ChineseErrorCorrector.dat import GrammarErrorDat

cged_tool = GrammarErrorDat()
print(cged_tool.other_wrong("小明住在北京,热爱NLP。"))
# 输出:None, 即无法进行此类错误的增强

  

**代码地址:**https://github.com/TW-NLP/ChineseErrorCorrector

相关推荐
小王不叫小王叭1 天前
Blip2:使用冻结图像编码器和大型语言模型的Bootstrapping图像预训练-2301
人工智能·语言模型·自然语言处理
AI人工智能+2 天前
通用表格识别:实现从非结构化图像到高保真数据的转换,提升业务流程自动化水平
深度学习·自然语言处理·ocr·表格识别
怦怦蓝2 天前
给AI装上“眼睛”:一文讲透视觉语言模型(VLM)
人工智能·语言模型·自然语言处理·vlm
manyingAi2 天前
AI漫剧制作全流程技术拆解:从NLP剧本解析到一致性角色生成
人工智能·自然语言处理
AI人工智能+3 天前
智能文档抽取系统通过“视觉感知+大模型认知“双引擎架构,实现非结构化文档的自动化处理
深度学习·计算机视觉·语言模型·自然语言处理·ocr·文档抽取
江畔柳前堤3 天前
HBM:大语言模型时代的「算力血液」——从内存墙到带宽革命的深度拆解
服务器·人工智能·windows·目标检测·语言模型·自然语言处理·软件工程
eric-sjq4 天前
10 分钟实战:用 0.6B 本地模型生成中文网页(WanlyFrontend + 编译器全流程)
javascript·机器学习·自然语言处理·html
2501_931819705 天前
苏州吴语语音活动检测标注交付公司
自然语言处理
大模型任我行5 天前
谷歌:扩散模型实现极速文本生成
人工智能·语言模型·自然语言处理·论文笔记
小影译片5 天前
什么是克隆配音(AI 语音克隆)
人工智能·自然语言处理·语音识别