/** @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 DocumentSpecies(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
@Override public void process(JCas jCas) throws AnalysisEngineProcessException { Map<Species, Integer> speciesCount = intDefaultMap(); for (LinnaeusSpecies sp : select(jCas, LinnaeusSpecies.class)) { // e.g. species:ncbi:9685 int speciesId = parseInt(sp.getMostProbableSpeciesId().substring( "species:ncbi:".length())); Species species = getOrElse(speciesMapping, speciesId, None); speciesCount.put(species, speciesCount.get(species) + 1); } DocumentSpecies docSpecies = new DocumentSpecies(jCas); if (!speciesCount.isEmpty()) { docSpecies .setFamilyName(keyOfHighestValue(speciesCount).toString()); } docSpecies.addToIndexes(); } }
/** @generated * @param jcas JCas to which this Feature Structure belongs */ public DocumentSpecies(JCas jcas) { super(jcas); readObject(); }
public FeatureStructure createFS(int addr, CASImpl cas) { if (DocumentSpecies_Type.this.useExistingInstance) { // Return eq fs instance if already created FeatureStructure fs = DocumentSpecies_Type.this.jcas.getJfsFromCaddr(addr); if (null == fs) { fs = new DocumentSpecies(addr, DocumentSpecies_Type.this); DocumentSpecies_Type.this.jcas.putJfsFromCaddr(addr, fs); return fs; } return fs; } else return new DocumentSpecies(addr, DocumentSpecies_Type.this); } };
@Override public void process(JCas jCas) throws AnalysisEngineProcessException { int pmId = getHeaderIntDocId(jCas); DocumentSpecies docSpecies = selectSingle(jCas, DocumentSpecies.class); String msg = pmId + "\t" + docSpecies.getFamilyName(); for (LinnaeusSpecies species : select(jCas, LinnaeusSpecies.class)) { msg += "\t" + species.getMostProbableSpeciesId() + "\t" + species.getCoveredText().replaceAll("\t", " "); } LOG.debug(msg); }
/** Internal - constructor used by generator * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public DocumentSpecies(int addr, TOP_Type type) { super(addr, type); readObject(); }