Package com.chenlb.mmseg4j.CharNode

Examples of com.chenlb.mmseg4j.CharNode.KeyTree.match()


  public void testMatch() {
    char[] w = "为什么".toCharArray();
    KeyTree kt = new KeyTree();
    kt.add(w);
    assertTrue(kt.match(w, 0, w.length));
    assertFalse(kt.match(w, 0, 2));
    assertFalse(kt.match("怎么样".toCharArray(), 0, 3));
   
    w = "国人民银行".toCharArray();
    kt.add(w);
View Full Code Here


  public void testMatch() {
    char[] w = "为什么".toCharArray();
    KeyTree kt = new KeyTree();
    kt.add(w);
    assertTrue(kt.match(w, 0, w.length));
    assertFalse(kt.match(w, 0, 2));
    assertFalse(kt.match("怎么样".toCharArray(), 0, 3));
   
    w = "国人民银行".toCharArray();
    kt.add(w);
    int tailLen = kt.maxMatch("中国人民银行".toCharArray(), 1);
View Full Code Here

    char[] w = "为什么".toCharArray();
    KeyTree kt = new KeyTree();
    kt.add(w);
    assertTrue(kt.match(w, 0, w.length));
    assertFalse(kt.match(w, 0, 2));
    assertFalse(kt.match("怎么样".toCharArray(), 0, 3));
   
    w = "国人民银行".toCharArray();
    kt.add(w);
    int tailLen = kt.maxMatch("中国人民银行".toCharArray(), 1);
    assertEquals(tailLen, w.length);
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.