Spark中使用HanLP分词

1.将HanLP的data(包含词典和模型)放到hdfs上,然后在项目配置文件hanlp.properties中配置root的路径,比如: root=hdfs://localhost:9000/tmp/ 2.实现com.hankcs.hanlp.corpus.io.IIOAdapter接口: 3.设置IoAdapter,创建分词器: 然后,就可以在Spark的操作中使用segment进行分词了。
相关文章
相关标签/搜索