@Override
public void process(JCas jcas) throws AnalysisEngineProcessException {
for (Annotation annotation : jcas.getAnnotationIndex(TokenAnnotation.type)) {
String tokenPOS = ((TokenAnnotation) annotation).getPosTag();
if ("np".equals(tokenPOS) || "nps".equals(tokenPOS)) {
EntityAnnotation entityAnnotation = new EntityAnnotation(jcas);
entityAnnotation.setBegin(annotation.getBegin());
entityAnnotation.setEnd(annotation.getEnd());
String entityString = annotation.getCoveredText();
entityAnnotation.setEntity(entityString);
String name = "OTHER"; // "OTHER" makes no sense. In practice, "PERSON", "COUNTRY", "E-MAIL", etc.
if(entityString.equals("Apache"))
name = "ORGANIZATION";
entityAnnotation.setName(name);
entityAnnotation.addToIndexes();
}
}
}