Package com.jpetrak.gate.stringannotation.extendedgazetteer3

Examples of com.jpetrak.gate.stringannotation.extendedgazetteer3.Lookup


    System.out.println("State after s: "+s2);
    System.out.println("isFinal: "+s2.isFinal());
    Iterator<Lookup> lookupIter = gs.getLookups(s2);
    System.out.println("Have lookups: "+lookupIter.hasNext());
    while(lookupIter.hasNext()) {
      Lookup l = lookupIter.next();
      System.out.println("Have a lookup"+l);
    }
    File someFile = new File("tmp.gazbin");
    try {
      gs.save(someFile);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
      assertTrue("could not save trie", false);
      return;
    }
    GazStoreTrie3 gs2 = new GazStoreTrie3();
    try {
      gs2 = (GazStoreTrie3)gs2.load(someFile);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
      assertTrue("could not load trie",false);
      return;
    }
    State init_2 = gs2.getInitialState();
    System.out.println("Initial State: "+init_2);
    State s1_2 = init_2.next('a');
    System.out.println("State after a: "+s1_2);
    System.out.println("isFinal: "+s1_2.isFinal());
    State s2_2 = s1_2.next('s');
    System.out.println("State after s: "+s2_2);
    System.out.println("isFinal: "+s2_2.isFinal());
    Iterator<Lookup> lookupIter_2 = gs2.getLookups(s2_2);
    System.out.println("Have lookups: "+lookupIter_2.hasNext());
    while(lookupIter_2.hasNext()) {
      Lookup l = lookupIter_2.next();
      System.out.println("Have a lookup"+l);
    }
   
    System.out.println("************* end ********************");
 
View Full Code Here


  }
 

  @Test
  public void test01()  {
    StoreArrayOfCharArrays as = new StoreArrayOfCharArrays();
   
    int i;
    char[] r;
    i = as.addData("asdfjk".toCharArray());
    assertEquals(0,i);
    i = as.addData("qwertyqwerty".toCharArray());
    assertEquals(8,i);
    r = as.getData(0);
    assertEquals("asdfjk",new String(r));
    r = as.getData(8);
    assertEquals("qwertyqwerty",new String(r));
   
    // test the list methods
    i = as.addListData("l1:4567890".toCharArray());
    assertEquals(22,i);
    int size = as.getListSize(i);
    assertEquals(1,size);
    r = as.getListData(i, 0);
    assertEquals("l1:4567890",new String(r));
   
    i = as.addListData(i,"l2:4567890".toCharArray());
    assertEquals(22,i);
    size = as.getListSize(i);
    assertEquals(2,size);
    r = as.getListData(i,1);
    assertEquals("l2:4567890",new String(r));
   
    i = as.addListData(i,"l3:4567890".toCharArray());
    assertEquals(22,i);
    size = as.getListSize(i);
    assertEquals(3,size);
    r = as.getListData(i,2);
    assertEquals("l3:4567890",new String(r));
   
    i = as.addListData("another".toCharArray());
    size = as.getListSize(i);
    assertEquals(1,size);
    r = as.getListData(i,0);
    assertEquals("another",new String(r));
  }
View Full Code Here

TOP

Related Classes of com.jpetrak.gate.stringannotation.extendedgazetteer3.Lookup

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.