/** * @generated * @param jcas JCas to which this Feature Structure belongs * @param begin offset to the begin spot in the SofA * @param end offset to the end spot in the SofA */ public Quotation(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
quotation1 = new Quotation(jCas); quotation1.setBegin(cursor); quotation1.setDepth(++depth); cursor += QUOTE1.length(); quotation1.setEnd(cursor); quotation1.addToIndexes(); quotation2 = new Quotation(jCas); quotation2.setBegin(++cursor); quotation2.setDepth(depth); cursor += QUOTE2.length(); quotation2.setEnd(cursor); quotation2.addToIndexes(); quotation3 = new Quotation(jCas); quotation3.setBegin(++cursor); quotation3.setDepth(++depth); cursor += QUOTE1.length(); quotation3.setEnd(cursor); quotation3.addToIndexes(); quotation4 = new Quotation(jCas); quotation4.setBegin(++cursor); quotation4.setDepth(depth); cursor += QUOTE2.length(); quotation4.setEnd(cursor); quotation4.addToIndexes(); quotation5 = new Quotation(jCas);
@Test public void testKeepSmallest() throws AnalysisEngineProcessException, ResourceInitializationException { addStructure(); final Quotation q = new Quotation(jCas, 28, 38); q.addToIndexes(); processJCas(TextBlocks.PARAM_KEEP_SMALLEST, true); final List<Text> list = new ArrayList<>(JCasUtil.select(jCas, Text.class)); assertEquals(1, list.size()); assertEquals("paragraph.", list.get(0).getCoveredText()); } }
assertEquals("quote1", r1.getName()); assertEquals(0, r1.getBegin()); assertEquals(quotation1.getEnd(), r1.getEnd()); assertEquals(quotation1.getEnd(), r2.getBegin()); assertEquals(quotation2.getEnd(), r2.getEnd()); field = fields.get(0); assertEquals("quote", field.getName()); assertEquals(quotation2.getBegin(), field.getBegin()); assertEquals(field.getBegin() + QUOTE2.length(), field.getEnd()); assertEquals(QUOTE2, field.getCoveredText()); assertEquals("quote2", r3.getName()); assertEquals(link1.getEnd(), r3.getBegin()); assertEquals(quotation3.getEnd(), r3.getEnd()); assertEquals(quotation3.getBegin(), field.getBegin()); assertEquals("quote", field.getName()); assertEquals(field.getBegin() + QUOTE1.length(), field.getEnd()); assertEquals(quotation3.getEnd(), r4.getBegin()); assertEquals(quotation4.getEnd(), r4.getEnd()); field = fields.get(0); assertEquals("quote", field.getName()); assertEquals(quotation4.getBegin(), field.getBegin()); assertEquals(field.getBegin() + QUOTE2.length(), field.getEnd()); assertEquals(QUOTE2, field.getCoveredText());
s = new Quotation(jCas); break;
/** * @generated * @param jcas JCas to which this Feature Structure belongs */ public Quotation(JCas jcas) { super(jcas); readObject(); }
quotation1 = new Quotation(jCas); quotation1.setBegin(cursor); quotation1.setDepth(++depth); cursor += QUOTE1.length(); quotation1.setEnd(cursor); quotation1.addToIndexes(); quotation2 = new Quotation(jCas); quotation2.setBegin(++cursor); quotation2.setDepth(depth); cursor += QUOTE2.length(); quotation2.setEnd(cursor); quotation2.addToIndexes(); quotation3 = new Quotation(jCas); quotation3.setBegin(++cursor); quotation3.setDepth(++depth); cursor += QUOTE1.length(); quotation3.setEnd(cursor); quotation3.addToIndexes(); quotation4 = new Quotation(jCas); quotation4.setBegin(++cursor); quotation4.setDepth(depth); cursor += QUOTE2.length(); quotation4.setEnd(cursor); quotation4.addToIndexes(); quotation5 = new Quotation(jCas);
@Test public void testKeepBiggest() throws AnalysisEngineProcessException, ResourceInitializationException { addStructure(); final Quotation q = new Quotation(jCas, 29, 38); q.addToIndexes(); processJCas(TextBlocks.PARAM_KEEP_SMALLEST, false); final List<Text> list = new ArrayList<>(JCasUtil.select(jCas, Text.class)); assertEquals(1, list.size()); assertEquals("This is a paragraph.", list.get(0).getCoveredText()); }
assertEquals(quotation2.getBegin(), field.getBegin()); assertEquals(field.getBegin() + QUOTE2.length(), field.getEnd()); assertEquals(QUOTE2, field.getCoveredText()); assertEquals(quotation3.getBegin(), field.getBegin()); assertEquals("quote", field.getName()); assertEquals(field.getBegin() + QUOTE1.length(), field.getEnd()); assertEquals(quotation4.getBegin(), field.getBegin()); assertEquals(field.getBegin() + QUOTE2.length(), field.getEnd()); assertEquals(QUOTE2, field.getCoveredText()); field = fields.get(0); assertEquals("quote", field.getName()); assertEquals(quotation5.getBegin(), field.getBegin()); assertEquals(field.getBegin() + QUOTE3.length(), field.getEnd()); assertEquals(QUOTE3, field.getCoveredText()); field = fields.get(0); assertEquals("row", r5.getName()); assertEquals(quotation5.getEnd(), r5.getBegin()); assertEquals(tableRow1.getEnd(), r5.getEnd());
s = new Quotation(jCas); break;
/** * Internal - constructor used by generator * * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public Quotation(int addr, TOP_Type type) { super(addr, type); readObject(); }
/** * @generated * @param jcas JCas to which this Feature Structure belongs * @param begin offset to the begin spot in the SofA * @param end offset to the end spot in the SofA */ public Quotation(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
/** * Internal - constructor used by generator * * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public Quotation(int addr, TOP_Type type) { super(addr, type); readObject(); }
/** * @generated * @param jcas JCas to which this Feature Structure belongs */ public Quotation(JCas jcas) { super(jcas); readObject(); }