/** @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 Concentration(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
@Override public void process(JCas aJCas) throws AnalysisEngineProcessException { Collection<Measure> allMeasureAnnotations = JCasUtil.select(aJCas, Measure.class); List<Measure> measuresToBeAdded = new LinkedList<Measure>(); for (Measure measure : allMeasureAnnotations) { if ((measure != null) && (measure.getUnit() != null) && ConcentrationContext.isConcentration(measure.getUnit())) { Concentration concentrationAnnotation = new Concentration(aJCas); concentrationAnnotation.setBegin(measure.getBegin()); concentrationAnnotation.setEnd(measure.getEnd()); concentrationAnnotation.setUnit(measure.getUnit()); concentrationAnnotation.setValue(measure.getValue()); measuresToBeAdded.add(concentrationAnnotation); } } for (Measure measure : measuresToBeAdded) { measure.addToIndexes(); } }
@Override public void process(JCas context) throws AnalysisEngineProcessException { if (mConcentrationNormalizer == null) { throw new AnalysisEngineProcessException( new Exception("NormalizedConcentrationAnnotator seems to have been badly initialized.")); } super.process(context); Collection<Concentration> allConcentrationAnnotations = JCasUtil.select(context, Concentration.class); for (Concentration concentrationAnnotation: allConcentrationAnnotations) { ValueUnitWrapper wrapper; try { wrapper = mConcentrationNormalizer.normalize(concentrationAnnotation.getValue(), concentrationAnnotation.getUnit()); concentrationAnnotation.setNormalizedUnit(wrapper.getUnit()); concentrationAnnotation.setNormalizedValue((float) wrapper.getValue()); } catch (UnknownUnitException e) { LOG.warn("[UnknownUnitException] : " + e.getMessage()); } } }
} else if (o instanceof Concentration) { Concentration c = (Concentration) o; return "Concentration[" + c.getCoveredText() + "]val:" + c.getValue() + ";unit:" + c.getUnit(); } else if (o instanceof Abbreviation) { Abbreviation a = (Abbreviation) o;
public FeatureStructure createFS(int addr, CASImpl cas) { if (Concentration_Type.this.useExistingInstance) { // Return eq fs instance if already created FeatureStructure fs = Concentration_Type.this.jcas.getJfsFromCaddr(addr); if (null == fs) { fs = new Concentration(addr, Concentration_Type.this); Concentration_Type.this.jcas.putJfsFromCaddr(addr, fs); return fs; } return fs; } else return new Concentration(addr, Concentration_Type.this); } };
/** Internal - constructor used by generator * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public Concentration(int addr, TOP_Type type) { super(addr, type); readObject(); }
/** @generated * @param jcas JCas to which this Feature Structure belongs */ public Concentration(JCas jcas) { super(jcas); readObject(); }