一键语法错误增强工具 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
一键语法错误增强工具 ChineseErrorCorrector的更多相关文章
- mac学习Python第二天:开发工具安装、编程方式、中文编码、syntaxError语法错误、注释、语法格式
一.python集成开发工具Visual Studio Code安装配置 1.官网下载安装VSCode 官网地址 https://code.visualstudio.com/下载软件包 VSCode ...
- Cmder | 一款命令行增强工具
文章目录 什么是cmder 安装cmder 让cmder便于使用 将cmder添加到右键菜单中 在设置中添加语言环境 设置默认使用cmd.PowerShell还是bash 调节背景的透明度 添加 ll ...
- "bower.json 中出现语法错误" 的解决方案之一
当你用 Visual Studio 2015 Update 3 打开从别处下载的开源项目的时候,如果发现 Bower 提示 "bower.json 中出现语法错误". 请检查一下. ...
- CentOS 6.3 中安装VirtualBOX增强工具失败:Building the main Guest Additions module[FAILED]
在VirtualBox里安装CentOS系统,会遇到“增强工具”无法正常安装,主要的原因是出在Kernel 库找不到. 错误提示如下: 通过查看日志文件: cat /var/log/vboxadd- ...
- 宿主系统为Ubuntu 14,CentOS 6.5 安装VirtualBox增强工具失败:Building the OpenGL support module[FAILED]
安装先前的笔记:CentOS 6.3 中安装VirtualBOX增强工具失败:Building the main Guest Additions module[FAILED],执行了以下命令 #安装 ...
- error C2589: “(”: “::”右边的非法标记 error C2059: 语法错误 : “::
1. 错误输出 ./zlibrary/ui/src/win32/w32widgets/W32VBorderBox.cpp(114) : error C2589: “(”: “::”右边的非法标记 ...
- 多种EDA软件的鼠标增强工具EDAHelper
最新版本(unicode版本,各种语言环境显示中文)下载地址:http://www.jyxtec.com/edahelper/EDAHelper-2.1.13.7z 繁体版:http://www.jy ...
- 使用node.js检查js语法错误
如果没有一些工具和插件写JavaScript代码遇到语法错误找起来很费时间,请教了同事怎么用node.js检查 用浏览器测试的时候报语法错误. 1.点击红圈中的蓝色按钮,下次刷新是会在抛出异常的时候自 ...
- vbox centos安装增强工具
就是虚拟机识别不了宿主机的usb接口,这个虚拟机有没有图形界面,看看怎么装. 一个是依赖包问题,另一个就是挂了安装包,但是我怎么找到它并安装上去的问题. 虚拟机是centos6.6哈 vbox4.3. ...
- VritualBox安装CentOS及安装增强工具图文教程
一 VM VirtualBox VirtualBox可在官网https://www.virtualbox.org/下载,完全免费. 二 安装CentOS系统(以CentOS6.9为例) 1.Cen ...
随机推荐
- Mysql 5.7 及以上版本修改密码
登录数据后.选择 mysql 数据库 use mysql; 修改密码 update user set authentication_string=PASSWORD("mynewpasswor ...
- ABC335
输 E 对于 \((u,v)\): 若 \(a_u = a_v\),则把 \(u\) 和 \(v\) 扔到同一个并查集里 否则连接两个点 然后跑一遍 dp 即可. code F 根号分治 如果 \(a ...
- 安装sql 2012 时遇到“需要更新的以前的 Visual Studio 2010 实例。”规则失败。
"需要更新的以前的 Visual Studio 2010 实例."规则失败.此计算机安装了需要 Service Pack 1 更新的 Visual Studio 2010,必须安装 ...
- 点击li 该li变色
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- http请求方式-CloseableHttpClient
http请求方式-CloseableHttpClient import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObjec ...
- 关于Lecture2建立一个Git远程仓库的补充
Smiling & Weeping ---- 心之何如,有似万丈迷津, 遥亘千里. 其中并无舟子可渡人, 除了自渡,他人爱莫能助. Git 远程仓库(Github) Git 并不像 SVN 那 ...
- 开启IPV6网络
1.路由器开启IPV6支持 2.路由器关闭IPV6 DHCP服务 3.若外网无法访问则关闭路由器防火墙 或关闭系统防火墙 4.tomcat需设置地址为0.0.0.0
- P9482 [NOI2023] 字符串
\(36pts\) \(O(tqn^2)\)暴力即可 \(40pts\) 对于最朴素的暴力优化,从头到尾扫,如果已经当前位字符比出优先级,那么直接能判断了,没必要往后跑了,第15个性质B的也给跑过了, ...
- Win10升Win11后出现的文件系统错误-1073740771的几种可能解决办法
可能性1 有服务没能启动 键盘按"WIN+R"打开"运行"对话框 在对话框输入"services.msc"点击"确定"按 ...
- 嵌入式Linux如何设置获取uboot参数
--- title: 嵌入式Linux如何设置获取uboot参数 EntryName: embeded-linux-debug-get-and-set-u-boot-envarg date: 2020 ...