shibing624 / pycorrector

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

一段长文本无法纠错,请问什么原因? #457

Closed cloudAndMonkey closed 6 months ago

cloudAndMonkey commented 9 months ago
>>> from pycorrector import MacBertCorrector
>>> m = MacBertCorrector("shibing624/macbert4csc-base-chinese")
>>> print(m.correct_batch(['本项目基于Kenlm统计语言模型工具训连了中文NGram语言模型']))
[{'source': '本项目基于Kenlm统计语言模型工具训连了中文NGram语言模型', 'target': '本项目基于Kenlm统计语言模型工具训连了中文NGram语言模型', 'errors': []}]
>>>

>>> idx_errors = m.detect('本项目基于Kenlm统计语言模型工具训连了中文NGram语言模型')
>>> print(idx_errors)
[]
>>> idx_errors = m.detect('训连了中文NGram语言模型')
>>> print(idx_errors)
[]
>>> idx_errors = m.detect('训连')
>>> print(idx_errors)
[['训连', 0, 2, 'word']]

在线测试:

image

请问是什么原因呢? @shibing624

shibing624 commented 9 months ago

单个case咋解释?