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

hanlp源码集成到springBoot中,windwo下一切正常,但是到linux上报错,字典路径找不到 #1232

Closed
1 task done
wasd345 opened this issue Jul 8, 2019 · 2 comments
Labels

Comments

@wasd345
Copy link

wasd345 commented Jul 8, 2019

注意事项

请确认下列注意事项:

  • 我已仔细阅读下列文档,都没有找到答案:
  • 我已经通过Googleissue区检索功能搜索了我的问题,也没有找到答案。
  • 我明白开源社区是出于兴趣爱好聚集起来的自由社区,不承担任何责任或义务。我会礼貌发言,向每一个帮助我的人表示感谢。
  • 我在此括号内输入x打钩,代表上述事项确认完毕

版本号

当前最新版本号是:1.7.4
我使用的版本是:1.7.4

我的问题

复现问题

步骤

1:首页我把hanlp源码复制到springboot项目里,没有用官网提供的两种方式,而是直接引入源码。
2:在window下测试一切正常
3:但在linux上部署后,报错,提示找不到字典路径
4:希望作者尽快看到回复,急用!!感激不尽!!!!

触发代码

   首先把hanlp源码复制到springBoot项目里,在window下运行正常,一部署到linux上提示找不到字典路径
		//调用分词组件生成 产品名称关键词
		List<ProductKeywordDO> keyList=new ArrayList<>();
		List<Term> gjzList=NotionalTokenizer.segment(product.getProdName());
		if(gjzList!=null&&gjzList.size()>0){
			for (int i = 0; i <gjzList.size() ; i++) {
				ProductKeywordDO pkd=new ProductKeywordDO();
				pkd.preInsert();
				pkd.setProductId(product.getId());
				pkd.setName(gjzList.get(i).word);
				pkd.setIsFc("2");
				keyList.add(pkd);
			}
		}

期望输出

期望能正确分词,然而现在报错,提示找不到字典路径

实际输出

现在报错,提示找不到字典路径,data目录应该放在linux上的什么位置才能被正确找到路径
02:13:50 [http-nio-8080-exec-10] ERROR HanLP - 自定义词典data/dictionary/custom/CustomDictionary.txt读取错误!java.io.FileNotFoundException: data/dictionary/custom/CustomDictionary.txt (No such file or directory)
02:13:50 [http-nio-8080-exec-10] WARN HanLP - 失败:data/dictionary/custom/CustomDictionary.txt
02:13:50 [http-nio-8080-exec-10] ERROR HanLP - 自定义词典data/dictionary/custom/现代汉语补充词库.txt读取错误!java.io.FileNotFoundException: data/dictionary/custom/现代汉语补充词库.txt (No such file or directory)
02:13:50 [http-nio-8080-exec-10] WARN HanLP - 失败:data/dictionary/custom/现代汉语补充词库.txt
02:13:50 [http-nio-8080-exec-10] ERROR HanLP - 自定义词典data/dictionary/custom/全国地名大全.txt读取错误!java.io.FileNotFoundException: data/dictionary/custom/全国地名大全.txt (No such file or directory)
02:13:50 [http-nio-8080-exec-10] WARN HanLP - 失败:data/dictionary/custom/全国地名大全.txt
02:13:50 [http-nio-8080-exec-10] ERROR HanLP - 自定义词典data/dictionary/custom/人名词典.txt读取错误!java.io.FileNotFoundException: data/dictionary/custom/人名词典.txt (No such file or directory)
02:13:50 [http-nio-8080-exec-10] WARN HanLP - 失败:data/dictionary/custom/人名词典.txt
02:13:50 [http-nio-8080-exec-10] ERROR HanLP - 自定义词典data/dictionary/custom/机构名词典.txt读取错误!java.io.FileNotFoundException: data/dictionary/custom/机构名词典.txt (No such file or directory)
02:13:50 [http-nio-8080-exec-10] WARN HanLP - 失败:data/dictionary/custom/机构名词典.txt
02:13:50 [http-nio-8080-exec-10] ERROR HanLP - 自定义词典data/dictionary/custom/上海地名.txt读取错误!java.io.FileNotFoundException: data/dictionary/custom/上海地名.txt (No such file or directory)
02:13:50 [http-nio-8080-exec-10] WARN HanLP - 失败:data/dictionary/custom/上海地名.txt
02:13:50 [http-nio-8080-exec-10] ERROR HanLP - 自定义词典data/dictionary/person/nrf.txt读取错误!java.io.FileNotFoundException: data/dictionary/person/nrf.txt (No such file or directory)
02:13:50 [http-nio-8080-exec-10] WARN HanLP - 失败:data/dictionary/person/nrf.txt
02:13:50 [http-nio-8080-exec-10] WARN HanLP - 没有加载到任何词条
02:13:50 [http-nio-8080-exec-10] ERROR HanLP - 自定义词典data/dictionary/custom/CustomDictionary.txt不存在!java.io.FileNotFoundException: data/dictionary/custom/CustomDictionary.txt.bin (No such file or directory)
02:13:50 [http-nio-8080-exec-10] WARN HanLP - 自定义词典[data/dictionary/custom/CustomDictionary.txt, data/dictionary/custom/现代汉语补充词库.txt, data/dictionary/custom/全国地名大全.txt ns, data/dictionary/custom/人名词典.txt, data/dictionary/custom/机构名词典.txt, data/dictionary/custom/上海地名.txt ns, data/dictionary/person/nrf.txt nrf]加载失败
02:13:50 [http-nio-8080-exec-10] WARN HanLP - 读取data/dictionary/CoreNatureDictionary.txt.bin时发生异常java.io.FileNotFoundException: data/dictionary/CoreNatureDictionary.txt.bin (No such file or directory)
02:13:50 [http-nio-8080-exec-10] WARN HanLP - 核心词典data/dictionary/CoreNatureDictionary.txt不存在!java.io.FileNotFoundException: data/dictionary/CoreNatureDictionary.txt (No such file or directory)

其他信息

希望作者尽快回复

@hankcs
Copy link
Owner

hankcs commented Jul 8, 2019

hanlp.properties配置不当,#983 (comment)

@hankcs
Copy link
Owner

hankcs commented Jan 1, 2020

感谢您对HanLP1.x的支持,我一直为没有时间回复所有issue感到抱歉,希望您提的问题已经解决。或者,您可以从《自然语言处理入门》中找到答案。

时光飞逝,HanLP1.x感谢您的一路相伴。我于东部标准时间2019年12月31日发布了HanLP1.x在上一个十年最后一个版本,代号为最后的武士。此后1.x分支将提供稳定性维护,但不是未来开发的焦点。

值此2020新年之际,我很高兴地宣布,HanLP2.0发布了。HanLP2.0的愿景是下一个十年的前沿NLP技术。为此,HanLP2.0采用TensorFlow2.0实现了最前沿的深度学习模型,通过精心设计的框架支撑下游NLP任务,在海量语料库上取得了最前沿的准确率。作为第一个alpha版本,HanLP 2.0.0a0支持分词、词性标注、命名实体识别、依存句法分析、语义依存分析以及文本分类。而且,这些功能并不仅限中文,而是面向全人类语种设计。HanLP2.0提供许多预训练模型,而终端用户仅需两行代码即可部署,深度学习落地不再困难。更多详情,欢迎观看HanLP2.0的介绍视频,或参与论坛讨论

展望未来,HanLP2.0将集成1.x时代继承下来的高效率务实风范,同时冲刺前沿研究,做工业界和学术界的两栖战舰,请诸君继续多多指教,谢谢。

@hankcs hankcs closed this as completed Jan 1, 2020
@hankcs hankcs added ignored and removed duplicated labels Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants