1 Star 3 Fork 2

Cetteest/pycorrector

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
use_custom_confusion.py 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
shibing624 提交于 3年前 . add confusion correct.
# -*- coding: utf-8 -*-
"""
@author:XuMing(xuming624@qq.com)
@description: 用户自定义混淆集,功能:1)补充纠错对,提升召回率;2)对误杀加白,提升准确率
"""
import sys
sys.path.append("..")
from pycorrector import ConfusionCorrector, Corrector
if __name__ == '__main__':
error_sentences = [
'买iphonex,要多少钱', # 漏召回
'我想喝小明同学。', # 漏召回
'哪里卖苹果吧?请大叔给我让坐', # 漏召回
'交通先行了怎么过去啊?', # 漏召回
'共同实际控制人萧华、霍荣铨、张旗康', # 误杀
'上述承诺内容系本人真实意思表示', # 正常
'大家一哄而伞怎么回事', # 成语
'交通银行的份额没有减少', # 误杀
]
m = Corrector()
for i in error_sentences:
print(i, ' -> ', m.detect(i), m.correct(i))
print('*' * 42)
m = ConfusionCorrector(custom_confusion_path_or_dict='./my_custom_confusion.txt')
for i in error_sentences:
print(i, ' -> ', m.confusion_correct(i))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cette/pycorrector.git
git@gitee.com:cette/pycorrector.git
cette
pycorrector
pycorrector
master

搜索帮助