一键语法错误增强工具 ChineseErrorCorrector
一键语法错误增强工具
欢迎使用我最近开源的使用一键语法错误增强工具,该工具可以进行14种语法错误的增强,不同行业可以根据自己的数据进行错误替换,来训练自己的语法和拼写模型,希望推动行业文本纠错的发展,欢迎Star,14种错误如下所示:
每种错误类型,对应的使用方法,如下所示:
环境的安装
1 | pip install ChineseErrorCorrector |
不同类型的数据增强
1 2 3 4 5 6 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.lack_word( "小明住在北京" )) # 输出:小明在北京 |
2.错别字错误
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.wrong_word( "小明住在北京" )) # 输出:小明住在北鲸 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.lack_char( "小明住在北京,热爱NLP。" )) # 输出:小明住在北京热爱NLP。 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.wrong_char( "小明住在北京" )) # 输出:小明住在北京。热爱NLP。 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.unknow_sub( "小明住在北京" )) # 输出:住在北京 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.unknow_pred( "小明住在北京" )) # 输出:小明在北京 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.lack_obj( "小明住在北京,热爱NLP。" )) # 输出:小明住在北京,热爱。 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.lack_others( "小明住在北京,热爱NLP。" )) # 输出:小明住北京,热爱NLP。 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.red_fun( "小明住在北京,热爱NLP。" )) # 输出:小明所住的在北京,热爱NLP。 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.red_component( "小明住在北京,热爱NLP。" )) # 输出:小明住在北京,热爱NLP。,看着 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.red_sub( "小明住在北京,热爱NLP。" )) # 输出:小明住在北京,小明热爱NLP。 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.wrong_sentence_order( "小明住在北京,热爱NLP。" )) # 输出:热爱NLP。,小明住在北京 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.wrong_ver_obj( "小明住在北京,热爱NLP。" )) # 输出:None ,即无法进行此类错误的增强 |
1 2 3 4 5 | from ChineseErrorCorrector.dat import GrammarErrorDat cged_tool = GrammarErrorDat() print (cged_tool.other_wrong( "小明住在北京,热爱NLP。" )) # 输出:None, 即无法进行此类错误的增强 |
代码地址:https://github.com/TW-NLP/ChineseErrorCorrector
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)