Skip to content

关于hanlp.properties中定义的data路径问题 #380

@fangyuan930917

Description

@fangyuan930917

最近一直在使用hanlp分词工具,发现hanlp.properties在data/dictionary路径的定义上并不灵活,root只能定死绝对路径。在将程序打包放到spark集群上运行,不可行。尝试改IOUtils的
public static InputStream newInputStream(String path) throws IOException
{
if (IOAdapter == null) return new FileInputStream(path);
return IOAdapter.open(path);
}
通过classloader的getresourceasStream方式读取,发现之后能实现将data放入到classpath下通过相对路径读取,但是牵一发动全身,很多地方都有异常,希望hancks大神有时间能解决下hanlp.properties只能通过绝对路径读入data的问题

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions