public FeatureStructure createFS(int addr, CASImpl cas) { if (Chemical_Type.this.useExistingInstance) { // Return eq fs instance if already created FeatureStructure fs = Chemical_Type.this.jcas.getJfsFromCaddr(addr); if (null == fs) { fs = new Chemical(addr, Chemical_Type.this); Chemical_Type.this.jcas.putJfsFromCaddr(addr, fs); return fs; } return fs; } else return new Chemical(addr, Chemical_Type.this); } };
@Override public void process(JCas jCas) throws AnalysisEngineProcessException { try { // TODO use oscar.findResolved??? for (NamedEntity ne : oscar.findNamedEntities(// jCas.getDocumentText())) { if (RELEVANT_TYPES.contains(ne.getType())) { Chemical chemical = new Chemical(jCas, ne.getStart(), ne.getEnd()); if (ne.getConfidence() != Double.NaN) chemical.setConfidence(ne.getConfidence() + ""); if (ne.getOntIds() != null && ne.getOntIds().size() > 0) chemical.setRegistryNumber(ne.getOntIds().iterator() .next()); // TODO chemical.setType(entity.getType()); chemical.addToIndexes(); } } } catch (Exception e) { throw new AnalysisEngineProcessException(e); } }