Package org.apache.uima.annotator.regex

Examples of org.apache.uima.annotator.regex.Feature


                     normalization = updateFeatures[x].getNormalization()
                           .intValue();
                  }
                  String implClass = updateFeatures[x].getClass1();
                  // create new feature and add them to the rule
                  Feature updateFeature = new Feature_impl(featureType,
                        featureName, featureValue, normalization, implClass);
                  rule.addUpdateFeature(updateFeature);
               }
            }

            // **********************************
            // get all exceptions for this rule
            // **********************************
            if (ruleList[r].getRuleExceptions() != null) {
               // iterate over all match type annotation update features and add
               // them to the rule
               ExceptionDocument.Exception[] exceptions = ruleList[r]
                     .getRuleExceptions().getExceptionArray();
               for (int x = 0; x < exceptions.length; x++) {
                  String exceptionMatchType = exceptions[x].getMatchType();
                  String regexPattern = exceptions[x].getStringValue();

                  // create new Exception object and add them to the rule
                  org.apache.uima.annotator.regex.RuleException exception = new RuleException_impl(
                        exceptionMatchType, regexPattern);
                  rule.addException(exception);
               }
            }

            // add rule to the concept
            concept.addRule(rule);
         }

         // **************************************
         // get all annotations for this concept
         // **************************************
         CreateAnnotationsDocument.CreateAnnotations annotations = concepts[i]
               .getCreateAnnotations();
         AnnotationDocument.Annotation[] annotationList = annotations
               .getAnnotationArray();
         for (int a = 0; a < annotationList.length; a++) {

            // create annotation position objects
            int beginMatchGroup = annotationList[a].getBegin().getGroup().intValue();
            int beginLocation = annotationList[a].getBegin().getLocation()
                  .intValue();
            int endMatchGroup = annotationList[a].getEnd().getGroup().intValue();
            int endLocation = annotationList[a].getEnd().getLocation()
                  .intValue();

            Position begin = new Position_impl(beginMatchGroup, beginLocation);
            Position end = new Position_impl(endMatchGroup, endLocation);

            // create annotation object
            String id = annotationList[a].getId();
            String type = annotationList[a].getType();
            String validationClass = annotationList[a].getValidate();

            Annotation annotation = new Annotation_impl(id, type, begin, end,
                  validationClass);

            // read out feature values and add it to the annotation
            SetFeatureDocument.SetFeature[] features = annotationList[a]
                  .getSetFeatureArray();
            for (int f = 0; f < features.length; f++) {
               String name = features[f].getName();
               int featureType = features[f].getType().intValue();
               String value = features[f].getStringValue();
               int normalization = 0;
               if (features[f].getNormalization() != null) {
                  normalization = features[f].getNormalization().intValue();
               }
               String implClass = features[f].getClass1();

               Feature feature = new Feature_impl(featureType, name, value,
                     normalization, implClass);
               annotation.addFeature(feature);
            }
            // add annotation to rule
            concept.addAnnotation(annotation);
View Full Code Here

TOP

Related Classes of org.apache.uima.annotator.regex.Feature

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.