|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--junit.framework.Assert | +--junit.framework.TestCase | +--gate.CookBook
This class provides examples of using the GATE APIs. Read this documentation along with a copy of the source code.
The CookBook is set up as part of the GATE test suite (using the JUnit framework), so there's an easy way to run the examples (viz., gate.TestGate.main, which will invoke the JUnit test runner). Also, we can use JUnit's assert methods; e.g. assert(corpus.isEmpty()); tests that a corpus object is empty, and creates a test failure report if this is not the case. To add a new test class to the suite, see the gate.util.TestTemplate class.
Programming to the GATE Java API involves manipulating the classes and interfaces in the gate package. These are often interfaces; classes there are often to do with getting access to objects that implement the interfaces (without exposing those implementations). In other words, there's a lot of interface-based design around.
The Factory class takes care of instantiating objects that implement the interfaces, via the createResource method and various other short-cut methods for popular resource types.
GATE breaks down the components of language processing systems into three types:
The rest of this documentation refers to methods in the code that provide examples of using the GATE API.
The testResourceCreation method gives an example of creating a resource via gate.Factory.
The Corpus interface represents collections of Documents (and takes the place of the old TIPSTER Collection class).
The testCorpusConstruction method gives an example of how to create a new transient Corpus object.
The testAddingDocuments method gives examples of adding documents to corpora.
The testAddingAnnotations method gives examples of adding annotations to documents.
The testUsingFeatures method gives examples of using features. The FeatureMap interface is a mechanism for associating arbitrary data with GATE entities. Corpora, documents and annotations all share this mechanism. Simple feature maps use Java's Map interface.
See also the other test classes, although note that they also use methods that are not part of the public API (which is restricted to the gate package. Test classes include: TestCreole; TestCorpus; TestDocument; TestAnnotation.
Constructor Summary | |
CookBook(String name)
Construction |
Method Summary | |
void |
setUp()
Fixture set up: initialise members before each test method |
static junit.framework.Test |
suite()
Test suite routine for the test runner |
void |
testAddingAnnotations()
Adding annotations to documents |
void |
testAddingDocuments()
Adding documents to a corpus |
void |
testCorpusConstruction()
Constructing a corpus |
void |
testResourceCreation()
Constructing a resource |
void |
testUsingFeatures()
Using the FeatureMap interface |
Methods inherited from class junit.framework.TestCase |
countTestCases, name, run, run, runBare, toString |
Methods inherited from class junit.framework.Assert |
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, fail, fail |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public CookBook(String name)
Method Detail |
public void testResourceCreation() throws GateException
public void testCorpusConstruction() throws GateException
public void testAddingDocuments() throws GateException
public void testAddingAnnotations()
public void testUsingFeatures()
public void setUp() throws GateException, IOException
public static junit.framework.Test suite()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |