/** * @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 TemplateRecordDefinition(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
@Override @Before public void setup() throws IOException { super.setup(); TemplateRecordDefinition record1 = new TemplateRecordDefinition(jCas); record1.setBegin(53); record1.setEnd(158); record1.setName("record1"); record1.addToIndexes(); }
@Test public void annotateRepeatingRecord() throws AnalysisEngineProcessException, ResourceInitializationException { jCas.setDocumentText(REPEAT_RECORD_TEXT); processJCas(); TemplateRecordDefinition record = JCasUtil.selectByIndex(jCas, TemplateRecordDefinition.class, 0); assertEquals(90, record.getBegin()); assertEquals(176, record.getEnd()); assertTrue(record.getRepeat()); assertEquals( " \n" + " Full Name: \n" + " <<field:PersonFullName>> \n" + " Description: \n" + " <<field:Description>>", record.getCoveredText()); } }
TemplateRecordDefinition recordDefinition) throws AnalysisEngineProcessException { String name = recordDefinition.getName(); if (recordConfigurations.containsKey(name)) { throw new AnalysisEngineProcessException( jCas, Structure.class, recordDefinition.getBegin(), recordDefinition.getBegin()) .stream() .max(Comparator.comparingInt(Structure::getDepth)); Optional<Structure> endStructure = JCasUtil.selectCovering( jCas, Structure.class, recordDefinition.getEnd(), recordDefinition.getEnd()) .stream() .max(Comparator.comparingInt(Structure::getDepth)); if (recordDefinition.getRepeat()) { int depth = Math.max( followingPath, fields, recordDefinition.getBegin())); } else { recordConfigurations.put( name, new TemplateRecordConfiguration( name, precedingPath, followingPath, fields, recordDefinition.getBegin()));
@Test public void annotate2Record() throws AnalysisEngineProcessException, ResourceInitializationException { jCas.setDocumentText(RECORD2_TEXT); processJCas(); TemplateRecordDefinition record = JCasUtil.selectByIndex(jCas, TemplateRecordDefinition.class, 0); assertEquals(83, record.getBegin()); assertEquals(169, record.getEnd()); assertEquals( " \n" + " Full Name: \n" + " <<field:PersonFullName>> \n" + " Description: \n" + " <<field:Description>>", record.getCoveredText()); TemplateRecordDefinition record2 = JCasUtil.selectByIndex(jCas, TemplateRecordDefinition.class, 1); assertEquals(293, record2.getBegin()); assertEquals(379, record2.getEnd()); assertEquals( " \n" + " Full Name: \n" + " <<field:PersonFullName>> \n" + " Description: \n" + " <<field:Description>>", record2.getCoveredText()); }
/** * @generated * @param jcas JCas to which this Feature Structure belongs */ public TemplateRecordDefinition(JCas jcas) { super(jcas); readObject(); }
@Override @Before public void setup() throws IOException { super.setup(); TemplateRecordDefinition record1 = new TemplateRecordDefinition(jCas); record1.setBegin(53); record1.setEnd(158); record1.setName("record1"); record1.setRepeat(true); record1.addToIndexes(); }
@Test public void annotateRecord() throws AnalysisEngineProcessException, ResourceInitializationException { jCas.setDocumentText(RECORD_TEXT); processJCas(); TemplateRecordDefinition record = JCasUtil.selectByIndex(jCas, TemplateRecordDefinition.class, 0); assertEquals(83, record.getBegin()); assertEquals(169, record.getEnd()); assertFalse(record.getRepeat()); assertEquals( " \n" + " Full Name: \n" + " <<field:PersonFullName>> \n" + " Description: \n" + " <<field:Description>>", record.getCoveredText()); }
/** * Internal - constructor used by generator * * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public TemplateRecordDefinition(int addr, TOP_Type type) { super(addr, type); readObject(); }
@Test(expected = AnalysisEngineProcessException.class) public void testErrorWhenRecordNameNotUnique() throws AnalysisEngineProcessException, ResourceInitializationException, JsonParseException, JsonMappingException, IOException { TemplateRecordDefinition record1 = new TemplateRecordDefinition(jCas); record1.setBegin(123); record1.setEnd(140); record1.setName("record1"); record1.addToIndexes(); TemplateFieldDefinition field1 = new TemplateFieldDefinition(jCas); field1.setBegin(72); field1.setEnd(75); field1.setName("myField1"); field1.addToIndexes(); processJCas( TemplateRecordConfigurationCreatingConsumer.PARAM_OUTPUT_DIRECTORY, tempDirectory.toString()); }
/** * @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 TemplateRecordDefinition(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
/** * @generated * @param jcas JCas to which this Feature Structure belongs */ public TemplateRecordDefinition(JCas jcas) { super(jcas); readObject(); }
/** * Internal - constructor used by generator * * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public TemplateRecordDefinition(int addr, TOP_Type type) { super(addr, type); readObject(); }