-
Notifications
You must be signed in to change notification settings - Fork 10k
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
hanlp打包问题 #983
Comments
有很多方案,任选一个:
从前往后优先级递减,一旦触发相应规则,无论data是否存在,不再检查后续规则。 |
可以将data文件夹放入src/main/resources(mvn项目资源默认文件夹, 或在pom中定义mvn资源文件夹地址), hanlp 默认的在corpus.io.IOAdaptor interface中默认是读取当前执行路径下的fileIO, 但是你可以根据当前环境具体情况改写. 可以自己overwrite corpus.io.FileIOAdapator来从resource文件夹读取data语聊. @Override
public InputStream open(String path) throws FileNotFoundException
{
InputStream is = getClass().getClassLoader().getResourceAsStream(path);
return is;
// return new FileInputStream(path);
}
@Override
public OutputStream create(String path) throws FileNotFoundException
{
try{
File file = new File(getClass().getClassLoader().getResource(path).toURI());
OutputStream output = new FileOutputStream(file);
return output;
}catch (Exception e) {
OutputStream output = new FileOutputStream(path);
return output;
}
// return new FileOutputStream(path);
} 然后在com.hankcs.hanlp.HanLP.class 下修改 /**
* IO适配器(默认null,表示从本地文件系统读取),实现com.hankcs.hanlp.corpus.io.IIOAdapter接口
* 以在不同的平台(Hadoop、Redis等)上运行HanLP
*/
public static IIOAdapter IOAdapter = new FileIOAdapter(); |
@zhangruinan @hankcs 请问这种情况如何处理? |
|
@zhangruinan 感谢及时回复,不过可能我表述不清楚,着实有点晕。其实这 4 点是一个统一的问题。 |
行得通,你可以把root设为 |
@hankcs 感谢回复,已经解决。 目前目录结构是这样的:
hanlp.properties
|
感谢您对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时代继承下来的高效率务实风范,同时冲刺前沿研究,做工业界和学术界的两栖战舰,请诸君继续多多指教,谢谢。 |
您好,我打包pyhanlp,要如何修改呀。 |
注意事项
请确认下列注意事项:
版本号
当前最新版本号是:1.6.8
我使用的版本是:1.6.8
我的问题
打包后找不到hanlp.properties
步骤
然后: 打包,执行打包命令
mvn clean package -Dmaven.test.skip=true
接着: 修改hanlp.properties中的root路径为data的父文件夹并放到target目录下,和hanlp-1.6.8-sources.jar、hanlp-1.6.8.jar在同一目录下,命令运行com.hankcs.hanlp.HanLP类的main方法:
期望输出
期望和hanlp-1.6.8-release.zip里面打包出来的效果一样,两个jar包一个配置文件。
实际输出
其他信息
The text was updated successfully, but these errors were encountered: