自定义词典问题-求助大佬

一、现有配置-hanlp.properties
CustomDictionaryPath=data/dictionary/custom/MyCustomDictionary.txt;data/dictionary/custom/CustomDictionary.txt; 现代汉语补充词库.txt; 全国地名大全.txt ns; 人名词典.txt; 机构名词典.txt; 上海地名.txt ns;data/dictionary/person/nrf.txt nrf;
其中MyCustomDictionary是自定义字典。

二、操作步骤
2.1、增加MyCustomDictionary.txt字典
2.2、删除已有的CustomDictionary.txt.bin
2.3、代码测试:
System.out.println(StandardTokenizer.segment(“触发问题的句子”));
System.out.println( HanLP.segment(“攻城狮”) );

三、结果
.bin文件参考其他人做法,应该会重新构建,但是没有生成新的.bin文件

bin文件命名是根据第一个词典(MyCustomDictionary.txt)命名的,没有看到的话一般是配置文件放错了地方没有被读取。你可以HanLP.enableDebug追踪一下。


配置是按照文档来的,编码也是utf-8的。
IIOAdapter重写如下:
public class ResourceFileIoAdapter implements IIOAdapter {
@Override
public InputStream open(String path) throws IOException {
ClassPathResource resource = new ClassPathResource( path );
InputStream is = new FileInputStream( resource.getFile() );
return is;
}

@Override
public OutputStream create(String path) throws IOException {
    ClassPathResource resource = new ClassPathResource( path );
    File file = resource.getFile();
    OutputStream os = new FileOutputStream(file);
    return os;
}

}
hanlp小白,还望大佬看下啊

我不觉得ClassPathResource会有写权限。

大佬,请教一下,我给bin删除了,但是我的项目没有重启,bin不会自动生成,是需要我的项目重启吗?然后在调用,会重新生成bin吗?