一键语法错误增强工具
欢迎使用一键语法错误增强工具,该工具可以进行14种语法错误的增强,不同行业可以根据自己的数据进行错误替换,来训练自己的语法和拼写模型。
使用:pip install ChineseErrorCorrector
开源不易,欢迎 star🌟
pypi:https://pypi.org/project/ChineseErrorCorrector/
介绍
一键语法错误增强工具,支持:
- 1.缺字漏字
- 2.错别字错误
- 3.缺少标点
- 4.错用标点
- 5.主语不明
- 6.谓语残缺
- 7.宾语残缺
- 8.其他成分残缺
- 9.虚词多余
- 10.其他成分多余
- 11.主语多余
- 12.语序不当
- 13.动宾搭配不当
- 14.其他搭配不当
注意
如果没有进行数据增强,则返回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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chineseerrorcorrector-1.6.0.tar.gz | 34.4 MB | Without provenance | Details for chineseerrorcorrector-1.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ChineseErrorCorrector-1.6.0-py3-none-any.whl | Python 3 | none | any | Details for ChineseErrorCorrector-1.6.0-py3-none-any.whl |
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
|
Security for ChineseErrorCorrector 1.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.