Senseval2LSReader extends SensevalReader { @Override public boolean hasNext() throws IOException, CollectionException { if (instanceIterator.hasNext()) { return true; } else { return lexeltIterator.hasNext(); } }  @SuppressWarnings("unchecked") @Override void initialize(UimaContext context); @SuppressWarnings("unchecked") @Override void getNext(JCas jCas); @Override boolean hasNext(); static final String PARAM_GUESS_POS; static final String PARAM_GUESS_LEMMA; }
@Test public void senseval2LSReaderTest() throws Exception { WSDItem w; LexicalItemConstituent c; CollectionReader reader = createReader( Senseval2LSReader.class, Senseval2LSReader.PARAM_FILE, "classpath:/senseval/senseval2ls.xml" ); JCasIterator i = new JCasIterator(reader); assertTrue(i.hasNext()); JCas j = i.next(); assertEquals("Eggs call for food.", j.getDocumentText()); assertEquals("en", j.getDocumentLanguage()); w = JCasUtil.selectByIndex(j, WSDItem.class, 0); assertEquals("call", w.getCoveredText()); assertEquals("call.1", w.getId()); assertEquals("call", w.getSubjectOfDisambiguation()); assertEquals(POS.VERB.toString(), w.getPos()); assertEquals(2, w.getConstituents().size()); c = w.getConstituents(0); assertNotNull(c.getConstituentType()); assertEquals("call", c.getCoveredText()); assertEquals("call.1", c.getId()); c = w.getConstituents(1); assertNotNull(c.getConstituentType()); assertEquals("for", c.getCoveredText()); assertEquals("call_for:1", c.getId()); w = JCasUtil.selectByIndex(j, WSDItem.class, -1); assertEquals("call", w.getCoveredText()); assertTrue(i.hasNext()); j = i.next(); assertEquals("Dave is an animal.", j.getDocumentText()); assertEquals("en", j.getDocumentLanguage()); assertFalse(i.hasNext()); w = JCasUtil.selectByIndex(j, WSDItem.class, -1); assertEquals("animal", w.getCoveredText()); assertEquals("animal.1", w.getId()); assertEquals(POS.NOUN.toString(), w.getPos()); }