Package org.apache.uima.alchemy.ts.entity

Examples of org.apache.uima.alchemy.ts.entity.AlchemyAnnotation


    Type type = fs.getType();
    String entityText = fs.getStringValue(type.getFeatureByBaseName("text"));
    int annotationStart = cas.getDocumentText().indexOf(entityText);
    if (annotationStart > 0) {
      // create annotation
      AlchemyAnnotation alchemyAnnotation = new AlchemyAnnotation(cas, annotationStart, annotationStart + entityText
              .length());
      alchemyAnnotation.setAlchemyType(type.toString());
      alchemyAnnotation.addToIndexes();
      UIMAFramework.getLogger().log(Level.INFO, new StringBuilder("added AlchemyAnnotation for ").append(alchemyAnnotation.getCoveredText()).append(" of type ").append(type.toString()).toString());
      // update entity occurrences
      NonEmptyFSList list = (NonEmptyFSList) fs.getOccurrences();
      if (list != null) {
        NonEmptyFSList newTail = new NonEmptyFSList(cas);
        newTail.setHead(list.getHead());
View Full Code Here


    String[] ants = StringUtils.substringsBetween(annotatedText, "[", "]");

    // map the ants to UIMA CAS
    for (String ant : ants) {
      if (ant.indexOf("[") > 0) {
        AlchemyAnnotation alchemyAnnotation = new AlchemyAnnotation(cas);

        int indexOfAnt = annotatedText.indexOf(ant);
        alchemyAnnotation.setBegin(indexOfAnt - 1);

        String antText = ant.substring(ant.indexOf("[") + 1);
        alchemyAnnotation.setEnd(indexOfAnt + antText.length() - 1);

        String antType = ant.substring(0, ant.indexOf("["));
        alchemyAnnotation.setAlchemyType(antType);
        alchemyAnnotation.addToIndexes();

        annotatedText = annotatedText.replaceFirst("\\[" + ant.replace("[", "\\[") + "\\]\\]",
                antText);
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.uima.alchemy.ts.entity.AlchemyAnnotation

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.