• ADADADADAD

    spark集群如何使用hanlp进行分布式分词[ mysql数据库 ]

    mysql数据库 时间:2024-11-28 13:02:53

    作者:文/会员上传

    简介:

    分两步:第一步:实现hankcs.hanlp/corpus.io.IIOAdapter1.public class HadoopFileIoAdapter implements IIOAdapter {2.3.@Override4.public InputStream open(String path) t

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    分两步:

    第一步:实现hankcs.hanlp/corpus.io.IIOAdapter

    1.public class HadoopFileIoAdapter implements IIOAdapter {

    2.

    3.@Override

    4.public InputStream open(String path) throws IOException {

    5.Configuration conf = new Configuration();

    6.FileSystem fs = FileSystem.get(URI.create(path), conf);

    7.return fs.open(new Path(path));

    8.}

    9.

    10.@Override

    11.public OutputStream create(String path) throws IOException {

    12.Configuration conf = new Configuration();

    13.FileSystem fs = FileSystem.get(URI.create(path), conf);

    14.OutputStream out = fs.create(new Path(path));

    15.return out;

    16.}

    17. }

    第二步:修改配置文件。root为hdfs上的数据包,把IOAdapter改为咱们上面实现的类

    ok,这样你就能在分布式集群上使用hanlp进行分词了。

    spark集群如何使用hanlp进行分布式分词.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: hanlpspark