GeniaPosParser implements Iterator<GeniaParse> { public GeniaParse next() { return parse((Element) articles.next()); } GeniaPosParser(File xmlFile);  GeniaPosParser(); boolean hasNext(); GeniaParse next(); void remove(); GeniaParse parse(Element articleElement); static void main(String[] args);  }
@Test public void testArticleA() throws Exception { File xmlFile = new File("src/test/resources/org/cleartk/corpus/genia/pos/GENIAcorpus3.02.articleA.pos.xml"); GeniaPosParser gp = new GeniaPosParser(xmlFile); GeniaParse parse = gp.next(); assertEquals("95369245", parse.getMedline()); assertTrue(parse.getText().startsWith( "IL-2 gene expression and NF-kappa B activation through CD28 requires reactive oxygen production by 5-lipoxygenase.")); assertEquals(144, parse.getPosTags().size()); GeniaTag posTag = parse.getPosTags().get(0); assertEquals("NN", posTag.getLabel()); assertEquals( "IL-2", parse.getText().substring(posTag.spans.get(0).begin, posTag.spans.get(0).end)); assertEquals(1, posTag.spans.size()); assertEquals("0|4", posTag.spans.get(0).toString()); posTag = parse.getPosTags().get(1); assertEquals("NN", posTag.getLabel()); assertEquals( "gene", parse.getText().substring(posTag.spans.get(0).begin, posTag.spans.get(0).end)); assertEquals("5|9", posTag.spans.get(0).toString()); posTag = parse.getPosTags().get(29); assertEquals("NN", posTag.getLabel()); assertEquals( "cell", parse.getText().substring(posTag.spans.get(0).begin, posTag.spans.get(0).end)); posTag = parse.getPosTags().get(70); assertEquals("JJ", posTag.getLabel()); assertEquals( "CD28-mediated", parse.getText().substring(posTag.spans.get(0).begin, posTag.spans.get(0).end)); posTag = parse.getPosTags().get(75); assertEquals("JJ", posTag.getLabel()); assertEquals( "B/CD28-responsive", parse.getText().substring(posTag.spans.get(0).begin, posTag.spans.get(0).end)); posTag = parse.getPosTags().get(142); assertEquals("NN", posTag.getLabel()); assertEquals( "pathway", parse.getText().substring(posTag.spans.get(0).begin, posTag.spans.get(0).end)); posTag = parse.getPosTags().get(143); assertEquals(".", posTag.getLabel()); assertEquals(".", parse.getText().substring(posTag.spans.get(0).begin, posTag.spans.get(0).end)); }