@Override public void process(JCas jCas) throws AnalysisEngineProcessException { boolean hasRodent = false; for (LinnaeusSpecies sp : select(jCas, LinnaeusSpecies.class)) { // e.g. species:ncbi:9685 int species = parseInt(sp.getMostProbableSpeciesId().substring( "species:ncbi:".length())); if (NCBI_MURIDAE.contains(species)) { hasRodent = true; break; } } if (!hasRodent) { // Copy the tokens into a new collection to avoid // ConcurrentModificationExceptions if (className.equals("all")) { for (TOP t : newArrayList(select(jCas, TOP.class))) t.removeFromIndexes(); } else { for (Annotation a : newArrayList(select(jCas, aClass))) a.removeFromIndexes(); } } }
@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); }
@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(); } }
for (LinnaeusSpecies specie : species) { malletToken.setFeatureValue(PROPERTY_SPECIES + specie.getMostProbableSpeciesId(), 1.0);