Package org.apache.solr.uima.ts

Examples of org.apache.solr.uima.ts.EntityAnnotation


  @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();
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.solr.uima.ts.EntityAnnotation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.