Closed PsyQuant closed 2 years ago
Describe the bug 添加自定义词典,强制模式不起作用
Code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem.
import hanlp HanLP = hanlp.load(“component”) text = “海航haihangMU3456航班” HanLP.dict_force = {“haihang”} print("-->", HanLP([text])[“tok/fine”]) --> [[‘海航’, ‘haihangMU3456’, ‘航班’]]
System information
OS Platform and Distribution: macOS big sur 11.3.1
Python version: 3.7
HanLP version: 2.1
[x] I've completed this form and searched the web for solutions.
你需要操作分词任务的属性,而不是MTL。
https://github.com/hankcs/HanLP/blob/b74d4ff1db9ad4c9aea5140db0b5a4be59e34c7b/plugins/hanlp_demo/hanlp_demo/zh/demo_custom_dict.py#L11
Describe the bug 添加自定义词典,强制模式不起作用
Code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem.
System information
OS Platform and Distribution: macOS big sur 11.3.1
Python version: 3.7
HanLP version: 2.1
[x] I've completed this form and searched the web for solutions.