Package com.chenlb.mmseg4j

Examples of com.chenlb.mmseg4j.Seg


  /* 线程内共享 */
  private ThreadLocal<MMSegTokenizer> tokenizerLocal = new ThreadLocal<MMSegTokenizer>();
  private Dictionary dic = null;
 
  private Seg newSeg(Map<String, String> args) {
    Seg seg = null;
    log.info("create new Seg ...");
    //default max-word
    String mode = args.get("mode");
    if("simple".equals(mode)) {
      log.info("use simple mode");
View Full Code Here


      System.out.println("\t-Dmode=simple, defalut is complex");
      System.out.println("\tPerformance <txt path> - is a directory that contain *.txt");
      return;
    }
    String mode = System.getProperty("mode", "complex");
    Seg seg = null;
    Dictionary dic = Dictionary.getInstance();
    if("simple".equals(mode)) {
      seg = new SimpleSeg(dic);
    } else {
      seg = new ComplexSeg(dic);
View Full Code Here

    return new ComplexSeg(dic);
  }
 
  public String segWords(Reader input, String wordSpilt) throws IOException {
    StringBuilder sb = new StringBuilder();
    Seg seg = getSeg()//取得不同的分词具体算法
    MMSeg mmSeg = new MMSeg(input, seg);
    Word word = null;
    boolean first = true;
    while((word=mmSeg.next())!=null) {
      if(!first) {
View Full Code Here

  public MMSegTokenizerFactory(Map<String, String> args) {
    super(args);
  }

  private Seg newSeg(Map<String, String> args) {
    Seg seg = null;
    log.info("create new Seg ...");
    //default max-word
    String mode = args.get("mode");
    if("simple".equals(mode)) {
      log.info("use simple mode");
View Full Code Here

  private ThreadLocal<MMSegTokenizer> tokenizerLocal = new ThreadLocal<MMSegTokenizer>();
  // protected dic for test
  protected Dictionary dic = null;
 
  private Seg newSeg(Map<String, String> args) {
    Seg seg = null;
    log.info("create new Seg ...");
    //default max-word
    String mode = args.get("mode");
    if("simple".equals(mode)) {
      log.info("use simple mode");
View Full Code Here

    return new ComplexSeg(dic);
  }
 
  public String segWords(Reader input, String wordSpilt) throws IOException {
    StringBuilder sb = new StringBuilder();
    Seg seg = getSeg()//取得不同的分词具体算法
    MMSeg mmSeg = new MMSeg(input, seg);
    Word word = null;
    boolean first = true;
    while((word=mmSeg.next())!=null) {
      if(!first) {
View Full Code Here

  /* 线程内共享 */
  private ThreadLocal<MMSegTokenizer> tokenizerLocal = new ThreadLocal<MMSegTokenizer>();
  private Dictionary dic = null;

  private Seg newSeg(Map<String, String> args) {
    Seg seg = null;
    log.info("create new Seg ...");
    //default max-word
    String mode = args.get("mode");
    if("simple".equals(mode)) {
      log.info("use simple mode");
View Full Code Here

  public MMSegTokenizerFactory(Map<String, String> args) {
    super(args);
  }

  private Seg newSeg(Map<String, String> args) {
    Seg seg = null;
    logger.info("create new Seg ...");
    //default max-word
    String mode = args.get("mode");
    if("simple".equals(mode)) {
      logger.info("use simple mode");
View Full Code Here

  public MMSegTokenizerFactory(Map<String, String> args) {
    super(args);
  }

  private Seg newSeg(Map<String, String> args) {
    Seg seg = null;
    logger.info("create new Seg ...");
    //default max-word
    String mode = args.get("mode");
    if("simple".equals(mode)) {
      logger.info("use simple mode");
View Full Code Here

  private ThreadLocal<MMSegTokenizer> tokenizerLocal = new ThreadLocal<MMSegTokenizer>();
  // protected dic for test
  protected Dictionary dic = null;

  private Seg newSeg(Map<String, String> args) {
    Seg seg = null;
    log.info("create new Seg ...");
    //default max-word
    String mode = args.get("mode");
    if("simple".equals(mode)) {
      log.info("use simple mode");
View Full Code Here

TOP

Related Classes of com.chenlb.mmseg4j.Seg

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.