Skip to content

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

@yixuan004

Description

@yixuan004

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions