shibing624 / pycorrector

pycorrector is a toolkit for text error correction. 文本纠错,实现了Kenlm,T5,MacBERT,ChatGLM3,Qwen2.5等模型应用在纠错场景,开箱即用。
https://www.mulanai.com/product/corrector/
Apache License 2.0
5.57k stars 1.1k forks source link

使用pip install -U pycorrector安装pycorrector最新版本后,测试运行报错 #486

Closed sovereign-stone closed 6 months ago

sovereign-stone commented 6 months ago

from pycorrector import T5Corrector

m = T5Corrector() res = m.correct_batch(['今天新情很好', '你找到你最喜欢的工作,我也很高心。']) print(res)

Traceback (most recent call last): File "/home/soc/gitcode/github/machine_learning/corrector_text/pycorrector.py", line 3, in from pycorrector import T5Corrector File "/home/soc/gitcode/github/machine_learning/corrector_text/pycorrector.py", line 3, in from pycorrector import T5Corrector ImportError: cannot import name 'T5Corrector' from partially initialized module 'pycorrector' (most likely due to a circular import) (/home/soc/gitcode/github/machine_learning/corrector_text/pycorrector.py)

Name: pycorrector Version: 1.0.4 Summary: Chinese Text Error Corrector Home-page: https://github.com/shibing624/pycorrector Author: XuMing Author-email: xuming624@qq.com License: Apache 2.0 Location: /home/**/machine_learn/lib/python3.8/site-packages Requires: datasets, jieba, loguru, numpy, pandas, pypinyin, six, transformers Required-by:

sovereign-stone commented 6 months ago

已解决!