分享

stanford segmenter中文分词怎么支持为分布式

Joker 发表于 2015-1-22 21:03:19 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 2 14937
使用stanford segmenter怎么分布式运行。我现在主要的问题是,该框架在加载分词器的时候会自动给你加入当前项目路径,使得我无法用上HDFS路径

代码如下
  1. private static final String basedir = System.getProperty("CRFUtils", "data");
  2.           private static String[] files = {"test/test.simp.utf8"};
  3.           
  4.           public static void main(String[] args) throws Exception {
  5.              
  6.             System.setOut(new PrintStream(System.out, true, "utf-8"));
  7.             Properties props = new Properties();
  8.             props.setProperty("sighanCorporaDict", basedir);
  9.             props.setProperty("serDictionary", basedir + "/dict-chris6.ser.gz");
  10.             if (files.length > 0) {
  11.               props.setProperty("testFile", files[0]);
  12.             }
  13.             props.setProperty("inputEncoding", "UTF-8");
  14.             props.setProperty("sighanPostProcessing", "true");
  15.             CRFClassifier<CoreLabel> segmenter = new CRFClassifier<CoreLabel>(props);
  16.             segmenter.loadClassifierNoExceptions(basedir + "/ctb.gz", props);  //这句话会加入当前项目路径
  17.             
  18.             //process input files
  19.             for (String filename : files) {
  20.               segmenter.classifyAndWriteAnswers(filename);
  21.             }
  22.           }
复制代码


有没有做过此类项目的前辈啊,跪求啊。

已有(2)人评论

跳转到指定楼层
s060403072 发表于 2015-1-22 21:55:46
没见过这种,目前没有发现它支持hadoop。
hadoop有很多中文分词算法,不一定非得用它。

回复

使用道具 举报

Joker 发表于 2015-1-26 11:36:59
没有人知道吗/?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条