一键语法错误增强工具 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 ...
随机推荐
- Flutter(三):Flutter App 可行性分析
一.生态建设 第三方Package https://pub.dev/packages?sort=popularity 截止2021年4月,第三方库达到17000+ 二.Devops 代码风格检查 An ...
- nginx接受请求连接事件模块流程
操作系统内核: 三次握手,当用户发来一个 SYN 报文时,系统内核会返回一个SYN+ACK确认给客户端,当客户端再次发送ACK来的时候,此时就已经建立了三次握手. 完成三次握手后,操作系统会根据系统内 ...
- react祖先与子孙多层传值
先做数据源store.js文件 // 状态 store 统一数据源 import React, { createContext } from 'react' // Provider 发布消息 // C ...
- LeetCode 673. Number of Longest Increasing Subsequence 最长递增子序列的个数 (C++/Java)
题目: Given an unsorted array of integers, find the number of longest increasing subsequence. Example ...
- uniapp windows 上架 apple store
香蕉云 蒲公英 ios上架助手iOS Development 开发!先用上架助手在certificates里面生成一个p12文件在profiles里面生成mobileprovision文件就欧克了 需 ...
- Caffe样例中mnist的文件之间逻辑分析
约定一下,Caffe运行样例时在终端中使用的所有命令,同时终端中的目录已经cd到Caffe之中(别告诉我一个Github项目你还没有make all就直接拿过来用了) sudo sh data/mni ...
- 深入理解Spring AOP中的@EnableAspectJAutoProxy
本文分享自华为云社区<Spring高手之路20--深入理解@EnableAspectJAutoProxy的力量>,作者: 砖业洋__. 1. 初始调试代码 面向切面编程(AOP)是一种编程 ...
- centos如何统计磁盘使用总量,以及cpu使用率
剩余硬盘容量 T: df | awk '{print $4}' |sed 's/Available//g' |sed '/^\s*$/d' | awk '{sum+=$1} END {print su ...
- Java 将Markdown文件转换为Word和PDF文档
Markdown 凭借其简洁易用的特性,成为创建和编辑纯文本文档的常用选择.但某些时候我们需要更加精致的展示效果,例如在专业分享文档或打印成离线使用的纸质版时,就需要将Markdown文件以其他固定的 ...
- 【论文阅读】BEVFormer: Learning Bird's-Eye-View Representation from Multi-Camera Images via Spatiotemporal
论文题目:BEVFormer: Learning Bird's-Eye-View Representation from Multi-Camera Images via Spatiotemporal ...