|
TestGazetteer |
|
1 /* 2 * TestGazetteer.java 3 * 4 * Copyright (c) 1998-2001, The University of Sheffield. 5 * 6 * This file is part of GATE (see http://gate.ac.uk/), and is free 7 * software, licenced under the GNU Library General Public License, 8 * Version 2, June 1991 (in the distribution as file licence.html, 9 * and also available at http://gate.ac.uk/gate/licence.html). 10 * 11 * Valentin Tablan, 25/10/2000 12 * 13 * $Id: TestGazetteer.java,v 1.12 2002/03/06 17:15:43 kalina Exp $ 14 */ 15 16 package gate.creole.gazetteer; 17 18 import java.util.*; 19 import java.io.*; 20 import java.net.*; 21 import java.beans.*; 22 import java.lang.reflect.*; 23 import junit.framework.*; 24 25 import gate.*; 26 import gate.util.*; 27 import gate.corpora.TestDocument; 28 29 public class TestGazetteer extends TestCase { 30 31 public TestGazetteer(String name) { 32 super(name); 33 } 34 35 /** Fixture set up */ 36 public void setUp() throws Exception { 37 } 38 39 public void tearDown() throws Exception { 40 } // tearDown 41 42 /** Test the default tokeniser */ 43 public void testDefaultGazetteer() throws Exception { 44 //get a document 45 Document doc = Factory.newDocument( 46 new URL(TestDocument.getTestServerName() + "tests/doc0.html") 47 ); 48 49 //create a default gazetteer 50 FeatureMap params = Factory.newFeatureMap(); 51 params.put(DefaultGazetteer.DEF_GAZ_LISTS_URL_PARAMETER_NAME, 52 new URL("gate:/creole/gazeteer/default/lists.def")); 53 DefaultGazetteer gaz = (DefaultGazetteer) Factory.createResource( 54 "gate.creole.gazetteer.DefaultGazetteer", params); 55 56 //runtime stuff 57 gaz.setDocument(doc); 58 gaz.setAnnotationSetName("GazetteerAS"); 59 gaz.execute(); 60 assertTrue(!doc.getAnnotations("GazetteerAS").isEmpty()); 61 } 62 63 /** Test suite routine for the test runner */ 64 public static Test suite() { 65 return new TestSuite(TestGazetteer.class); 66 } // suite 67 68 public static void main(String[] args) { 69 try{ 70 Gate.init(); 71 TestGazetteer testGaz = new TestGazetteer(""); 72 testGaz.setUp(); 73 testGaz.testDefaultGazetteer(); 74 testGaz.tearDown(); 75 } catch(Exception e) { 76 e.printStackTrace(); 77 } 78 } // main 79 80 } // TestGazetteer 81
|
TestGazetteer |
|