Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文本纠错AssertionError #50

Open
wannian1997 opened this issue Jan 6, 2023 · 5 comments
Open

文本纠错AssertionError #50

wannian1997 opened this issue Jan 6, 2023 · 5 comments
Assignees

Comments

@wannian1997
Copy link

checker.py文件中50行assert len(mask_id) == 1出现AssertionError请问如何解决

@wannian1997
Copy link
Author

我将这句改为了assert len(mask_id) >= 1,但是这样输出的结果为类似{(8, ''): [('[', 0.8247228860855103), (']', 0.08479063957929611), ('被', 0.006882567889988422), ('/', 0.0036284865345805883), ('『', 0.0036059825215488672)]},缺少了原本的错误的字。

@SeanLee97
Copy link
Owner

将你的输入文本和测试代码也发一下?不然不好追踪原因。

@wannian1997
Copy link
Author

wannian1997 commented Jan 6, 2023

'import xmnlp
modelPath = r"E:\deepLearning\xmnlp-onnx-models"
xmnlp.set_model(modelPath)
text = "不能适应体育专业选拔人材的要求"
print(xmnlp.checker(text))'

Lazy load checker...
Traceback (most recent call last):
File "E:/deepLearning/Bert-Chinese-Text-Classification-Pytorch/toolTest.py", line 6, in
print(xmnlp.checker(text))
File "D:\Programs\Anaconda\envs\py36\lib\site-packages\xmnlp\checker_init_.py", line 40, in spellcheck
load_checker()
File "D:\Programs\Anaconda\envs\py36\lib\site-packages\xmnlp\checker_init_.py", line 29, in load_checker
os.path.join(config.MODEL_DIR, 'checker'))
File "D:\Programs\Anaconda\envs\py36\lib\site-packages\xmnlp\checker\checker.py", line 50, in init
assert len(mask_id) == 1
AssertionError

进程已结束,退出代码1

@SeanLee97 SeanLee97 self-assigned this Jan 6, 2023
@jiluojiluo
Copy link

import xmnlp
text = "不能适应体育专业选拔人材的要求"
File "", line 1
text = "不能适应体育专业选拔人材的要求"
IndentationError: unexpected indent
text = "不能适应体育专业选拔人材的要求"
print(xmnlp.checker(text))
(Lazy Load) Loading model...
start to build dictionary...
done !
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\l00660157\Anaconda3\envs\labelme\Lib\site-packages\xmnlp_init_.py", line 135, in checker
return checker.check(text, level=level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\l00660157\Anaconda3\envs\labelme\Lib\site-packages\xmnlp\checker_init
.py", line 48, in check
return model.best_match(doc)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\l00660157\Anaconda3\envs\labelme\Lib\site-packages\xmnlp\checker\checker.py", line 110, in best_match
return self.word_checker(word)[0]
~~~~~~~~~~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable

@jiluojiluo
Copy link

我的报这个错误

TypeError: 'NoneType' object is not subscriptable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants