Skip to main content

一键语法错误增强工具

欢迎使用一键语法错误增强工具,该工具可以进行14种语法错误的增强,不同行业可以根据自己的数据进行错误替换,来训练自己的语法和拼写模型。

使用:pip install ChineseErrorCorrector

开源不易,欢迎 star🌟

pypi:https://pypi.org/project/ChineseErrorCorrector/


介绍

一键语法错误增强工具,支持:

注意

如果没有进行数据增强,则返回None


API

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。"))
# 输出:小明住在北京。热爱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, 即无法进行此类错误的增强

Metadata

Release files for ChineseErrorCorrector 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ChineseErrorCorrector 1.6.0
File Size Uploaded
chineseerrorcorrector-1.6.0.tar.gz 34.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ChineseErrorCorrector 1.6.0
File Interpreter ABI Platform
ChineseErrorCorrector-1.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 68.7 MB

Release files / chineseerrorcorrector-1.6.0.tar.gz

Download URL chineseerrorcorrector-1.6.0.tar.gz
Size 34.4 MB
Tags Source
SHA-256 checksum
How to use checksums
f50da65ad753b5a05ee3f06d32daec0c80e2511820223425da5a622096361c9e
BLAKE2b-256 checksum
How to use checksums
673fa9003aecf1abd3d3da68102b5ec25049af7246744f409873d2cc6e5679f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.19

Release files / ChineseErrorCorrector-1.6.0-py3-none-any.whl

Download URL ChineseErrorCorrector-1.6.0-py3-none-any.whl
Size 34.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
52b1c309cf5a498f018f4ea655e6c4fec178ed12306d1a3092f85e7043ee1dbc
BLAKE2b-256 checksum
How to use checksums
ebc93f6ef71dac5449920518ba2fd6af5e18cc7622a629a04597e40ea5fed73f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.19

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page