Examples of IKSegmentation


Examples of org.wltea.analyzer.IKSegmentation

   */
  public IKTokenizer(Reader in , boolean isMaxWordLength) {
      super(in);
      offsetAtt = addAttribute(OffsetAttribute.class);
      termAtt = addAttribute(TermAttribute.class);
    _IKImplement = new IKSegmentation(in , isMaxWordLength);
 
View Full Code Here

Examples of org.wltea.analyzer.IKSegmentation

    }else{
      //System.out.println(System.currentTimeMillis());
      root = new TokenBranch(null);   
      //对查询条件q进行分词
      StringReader input = new StringReader(query.trim());
      IKSegmentation ikSeg = new IKSegmentation(input , isMaxWordLength);
      try {
        for(Lexeme lexeme = ikSeg.next() ; lexeme != null ; lexeme = ikSeg.next()){
          //处理词元分支
          root.accept(lexeme);
        }
      } catch (IOException e) {
        e.printStackTrace();
View Full Code Here

Examples of org.wltea.analyzer.IKSegmentation

//    } catch (IOException e) {
//      // TODO Auto-generated catch block
//      e.printStackTrace();
//    }
    System.out.println(t)
    IKSegmentation ikSeg = new IKSegmentation(new StringReader(t) ,false);
    try {
      Lexeme l = null;
      while( (l = ikSeg.next()) != null){
        System.out.println(l);
      }
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

Examples of org.wltea.analyzer.IKSegmentation

    testStr.add("第21个人 第100位 第10个月");
   
   
    for(String t : testStr){
      System.out.println(t)
      IKSegmentation ikSeg = new IKSegmentation(new StringReader(t) , false);
      try {
        Lexeme l = null;
        while( (l = ikSeg.next()) != null){
          System.out.println(l);
        }
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
View Full Code Here

Examples of org.wltea.analyzer.IKSegmentation

//
//    testStr.add("向浙江省长兴县安监局等多部门反应");
//    testStr.add("浙江省长兴县城管在光天化日之下明抢东东");
    for(String t : testStr){
      System.out.println(t)
      IKSegmentation ikSeg = new IKSegmentation(new StringReader(t) , false);
      try {
        Lexeme l = null;
        while( (l = ikSeg.next()) != null){
          System.out.println(l);
        }
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
View Full Code Here

Examples of org.wltea.analyzer.IKSegmentation

+"朋友说我越来越不正常。我说是,一个迷恋夜晚的女子怎么可能正常。 "
+"有人在背后开始对我指指点点,说一个30岁的女人还不结婚一定是有问题。 "
+"我不为所动。 但是我知道,总有一天,我会老去,且没有人会再听我说话。";
    }
    System.out.println("Length = " + testString.length() + "  | " +testString.getBytes().length);
    IKSegmentation ikSeg = new IKSegmentation(new StringReader(testString) , false);
   
    try {
      Thread.sleep(5000);
    } catch (InterruptedException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
   
    long begin = System.currentTimeMillis();  
    try {
      Lexeme l = null;
//      while( (l = ikSeg.next()) != null){
//        System.out.println(l);
//      }
      while( ikSeg.next()!= null);
     
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
View Full Code Here

Examples of org.wltea.analyzer.IKSegmentation

    }else{
      //System.out.println(System.currentTimeMillis());
      root = new TokenBranch(null);   
      //对查询条件q进行分词
      StringReader input = new StringReader(query.trim());
      IKSegmentation ikSeg = new IKSegmentation(input , isMaxWordLength);
      for(Lexeme lexeme = ikSeg.next() ; lexeme != null ; lexeme = ikSeg.next()){
        //处理词元分支
        root.accept(lexeme);
      }
      //缓存解析结果的博弈树
      cachedTokenBranch(query , root);
View Full Code Here

Examples of org.wltea.analyzer.IKSegmentation

//    } catch (IOException e) {
//      // TODO Auto-generated catch block
//      e.printStackTrace();
//    }
    System.out.println(t)
    IKSegmentation ikSeg = new IKSegmentation(new StringReader(t) ,true);
    try {
      Lexeme l = null;
      while( (l = ikSeg.next()) != null){
        System.out.println(l);
      }
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

Examples of org.wltea.analyzer.IKSegmentation

    testStr.add("福州第一中学福州一中福州第三十六中赐进士及第");
   
   
    for(String t : testStr){
      System.out.println(t)
      IKSegmentation ikSeg = new IKSegmentation(new StringReader(t) , true);
      try {
        Lexeme l = null;
        while( (l = ikSeg.next()) != null){
          System.out.println(l);
        }
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
View Full Code Here

Examples of org.wltea.analyzer.IKSegmentation

//    testStr.add("向浙江省长兴县安监局等多部门反应");
//    testStr.add("浙江省长兴县城管在光天化日之下明抢东东");
    testStr.add("广州市越秀区广州大道中131-133号信龙大厦");
    for(String t : testStr){
      System.out.println(t)
      IKSegmentation ikSeg = new IKSegmentation(new StringReader(t) , false);
      try {
        Lexeme l = null;
        while( (l = ikSeg.next()) != null){
          System.out.println(l);
        }
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.