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進行分詞了。
相關文章
相關標籤/搜索