/** @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 LinnaeusSpecies(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
@Override public void process(JCas cas) throws AnalysisEngineProcessException { String text = cas.getDocumentText(); List<Mention> mentions = matcher.match(text); for (Mention mention : mentions) { String mostProbableID = mention.getMostProbableID(); String idsToString = mention.getIdsToString(); LinnaeusSpecies species = new LinnaeusSpecies(cas); species.setBegin(mention.getStart()); species.setEnd(mention.getEnd()); species.setMostProbableSpeciesId(mostProbableID); species.setAllIdsString(idsToString); species.setAmbigous(mention.isAmbigous()); species.addToIndexes(); } }
@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 { 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(); } } }
public FeatureStructure createFS(int addr, CASImpl cas) { if (LinnaeusSpecies_Type.this.useExistingInstance) { // Return eq fs instance if already created FeatureStructure fs = LinnaeusSpecies_Type.this.jcas.getJfsFromCaddr(addr); if (null == fs) { fs = new LinnaeusSpecies(addr, LinnaeusSpecies_Type.this); LinnaeusSpecies_Type.this.jcas.putJfsFromCaddr(addr, fs); return fs; } return fs; } else return new LinnaeusSpecies(addr, LinnaeusSpecies_Type.this); } };
/** @generated * @param jcas JCas to which this Feature Structure belongs */ public LinnaeusSpecies(JCas jcas) { super(jcas); 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(); } }
/** Internal - constructor used by generator * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public LinnaeusSpecies(int addr, TOP_Type type) { super(addr, type); readObject(); }
for (LinnaeusSpecies specie : species) { malletToken.setFeatureValue(PROPERTY_SPECIES + specie.getMostProbableSpeciesId(), 1.0);