Skip to content
New issue

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

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

Already on GitHub? # to your account

调用CustomDictionary.reload()返回false,无法更新词典 #1635

Closed
1 task done
yixuan004 opened this issue Mar 23, 2021 · 4 comments
Closed
1 task done

调用CustomDictionary.reload()返回false,无法更新词典 #1635

yixuan004 opened this issue Mar 23, 2021 · 4 comments
Assignees
Labels

Comments

@yixuan004
Copy link

yixuan004 commented Mar 23, 2021

Describe the bug
A clear and concise description of what the bug is.
from hanlp import CustomDictionary 后,调用CustomDictionary.reload()返回false,无法更新词典,通过打印部分日志后仍然没有解决问题
image

Code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate the problem.

from pyhanlp import CustomDictionary, HanLP
print(HanLP.Config.CustomDictionaryPath)
('/usr/local/python3/lib/python3.6/site-packages/pyhanlp/static/data/dictionary/custom/CustomDictionary.txt', '/usr/local/python3/lib/python3.6/site-packages/pyhanlp/static/data/dictionary/custom/现代汉语补充词库.txt', '/usr/local/python3/lib/python3.6/site-packages/pyhanlp/static/data/dictionary/custom/全国地名大全.txt ns', '/usr/local/python3/lib/python3.6/site-packages/pyhanlp/static/data/dictionary/custom/人名词典.txt', '/usr/local/python3/lib/python3.6/site-packages/pyhanlp/static/data/dictionary/custom/机构名词典.txt', '/usr/local/python3/lib/python3.6/site-packages/pyhanlp/static/data/dictionary/custom/上海地名.txt ns', '/usr/local/python3/lib/python3.6/site-packages/pyhanlp/static/data/dictionary/person/nrf.txt nrf')
print(CustomDictionary.DEFAULT.path)
()
print(CustomDictionary.reload())
False

Describe the current behavior
A clear and concise description of what happened.
reload永远返回false,暂时无法定位具体原因

Expected behavior
A clear and concise description of what you expected to happen.
期望reload得到True的返回结果,成功更新

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux 3.10.0-957.el7.x86_64 while 方法可能少写break #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Python version: 3.6.8
  • HanLP version: 0.1.63

Other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
见上边的截图中

  • I've completed this form and searched the web for solutions.
@yixuan004
Copy link
Author

image

调用insert方法是正常的,调用reload方法永远为false,安装方式是在python3.6.8的环境下,通过pip install pyhanlp==0.1.63进行的安装,无任何其他操作

hankcs added a commit that referenced this issue Mar 23, 2021
@hankcs
Copy link
Owner

hankcs commented Mar 23, 2021

感谢反馈,已经修复,请参考上面的commit。
如果还有问题,欢迎重开issue。

你可以使用这个新的jar。

hanlp-1.8.1.jar.zip

@hankcs hankcs closed this as completed Mar 23, 2021
@yixuan004
Copy link
Author

非常感谢,已解决

@hanlpbot
Copy link
Collaborator

This issue has been mentioned on Butterfly Effect. There might be relevant details there:

https://bbs.hankcs.com/t/topic/3549/3

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

No branches or pull requests

3 participants