Package org.apache.uima.cas

Examples of org.apache.uima.cas.Feature


      if (typeSystem.subsumes(annotationType, range)) {

        String name = eachFeature1.getShortName();

        Feature eachFeature2 = type2.getFeatureByBaseName(name);

        FeatureStructure featureValue1 = a1.getFeatureValue(eachFeature1);

        FeatureStructure featureValue2 = a2.getFeatureValue(eachFeature2);

        allEmpty1 &= featureValue1 == null;

        allEmpty2 &= featureValue2 == null;

        if (featureValue1 instanceof AnnotationFS && featureValue2 instanceof AnnotationFS) {

          result &= matchAnnotations((AnnotationFS) featureValue1, (AnnotationFS) featureValue2);

        } else if (featureValue1 == null) {

          // nothing to do

        } else if (featureValue1 != null || featureValue2 != null) {

          return false;

        }

      }

      if (UIMAConstants.TYPE_STRING.equals(range.getName())) {
        String name = eachFeature1.getShortName();
        Feature eachFeature2 = type2.getFeatureByBaseName(name);
        String featureValue1 = a1.getFeatureValueAsString(eachFeature1);
        String featureValue2 = a2.getFeatureValueAsString(eachFeature2);
       
        if ((StringUtils.isBlank(featureValue2)) && StringUtils.isBlank(featureValue1)) {
          // nothing to do
View Full Code Here


    Type annotationType = test.getAnnotationType();
    Type falsePositiveType = run.getTypeSystem().getType(ICasEvaluator.FALSE_POSITIVE);
    Type falseNegativeType = run.getTypeSystem().getType(ICasEvaluator.FALSE_NEGATIVE);
    Type truePositveType = run.getTypeSystem().getType(ICasEvaluator.TRUE_POSITIVE);

    Feature feature = falsePositiveType.getFeatureByBaseName(ICasEvaluator.ORIGINAL);
    List<Type> types = getTypes(test, excludedTypes, annotationType, useAllTypes);

    List<AnnotationFS> testAnnotations = getAnnotations(types, test, includeSubtypes);
    List<AnnotationFS> runAnnotations = getAnnotations(types, run, includeSubtypes);
View Full Code Here

    Type annotationType = test.getAnnotationType();
    Type falsePositiveType = run.getTypeSystem().getType(ICasEvaluator.FALSE_POSITIVE);
    Type falseNegativeType = run.getTypeSystem().getType(ICasEvaluator.FALSE_NEGATIVE);
    Type truePositveType = run.getTypeSystem().getType(ICasEvaluator.TRUE_POSITIVE);

    Feature feature = falsePositiveType.getFeatureByBaseName(ICasEvaluator.ORIGINAL);
    List<Type> types = getTypes(test, excludedTypes, annotationType, useAllTypes);

    List<AnnotationFS> testAnnotations = getAnnotations(types, test, includeSubtypes);
    List<AnnotationFS> runAnnotations = getAnnotations(types, run, includeSubtypes);
View Full Code Here

    Type annotationType = test.getAnnotationType();
    Type falsePositiveType = run.getTypeSystem().getType(ICasEvaluator.FALSE_POSITIVE);
    Type falseNegativeType = run.getTypeSystem().getType(ICasEvaluator.FALSE_NEGATIVE);
    Type truePositveType = run.getTypeSystem().getType(ICasEvaluator.TRUE_POSITIVE);

    Feature feature = falsePositiveType.getFeatureByBaseName(ICasEvaluator.ORIGINAL);
    List<Type> types = getTypes(test, excludedTypes, annotationType, useAllTypes);

    List<AnnotationFS> testAnnotations = getAnnotations(types, test, includeSubtypes);
    List<AnnotationFS> runAnnotations = getAnnotations(types, run, includeSubtypes);
View Full Code Here

  }

  public static List<StatisticsEntry> createEntries(FeatureStructure fs) {
    List<StatisticsEntry> result = new ArrayList<StatisticsEntry>();
    Type type = fs.getCAS().getTypeSystem().getType(TYPE);
    Feature fname = type.getFeatureByBaseName(NAMES);
    Feature ftotal = type.getFeatureByBaseName(TOTALS);
    Feature famount = type.getFeatureByBaseName(AMOUNTS);
    Feature fparts = type.getFeatureByBaseName(PARTS);
    StringArrayFSImpl vname = (StringArrayFSImpl) fs.getFeatureValue(fname);
    DoubleArrayFSImpl vtotal = (DoubleArrayFSImpl) fs.getFeatureValue(ftotal);
    IntArrayFSImpl vamount = (IntArrayFSImpl) fs.getFeatureValue(famount);
    DoubleArrayFSImpl vpart = (DoubleArrayFSImpl) fs.getFeatureValue(fparts);
View Full Code Here

    if (typeMap != null) {
      Map<String, Object> map = typeMap.get(type);
      if (map != null) {
        for (Entry<String, Object> eachEntry : map.entrySet()) {
          String featureName = eachEntry.getKey();
          Feature feature = type.getFeatureByBaseName(featureName);
          if (feature != null) {
            Object argExpr = eachEntry.getValue();
            Type range = feature.getRange();
            if (argExpr instanceof INumberExpression) {
              INumberExpression ne = (INumberExpression) argExpr;
              int cg = ne.getIntegerValue(getParent(), afs, stream);
              if (range.getName().equals(UIMAConstants.TYPE_STRING)) {
                String s = matchResult.group(cg);
View Full Code Here

    Type annotationType = test.getAnnotationType();
    Type falsePositiveType = run.getTypeSystem().getType(ICasEvaluator.FALSE_POSITIVE);
    Type falseNegativeType = run.getTypeSystem().getType(ICasEvaluator.FALSE_NEGATIVE);
    Type truePositveType = run.getTypeSystem().getType(ICasEvaluator.TRUE_POSITIVE);

    Feature feature = falsePositiveType.getFeatureByBaseName(ICasEvaluator.ORIGINAL);
    List<Type> types = getTypes(test, excludedTypes, annotationType, useAllTypes);

    List<AnnotationFS> testAnnotations = getAnnotations(types, test, includeSubtypes);
    List<AnnotationFS> runAnnotations = getAnnotations(types, run, includeSubtypes);
View Full Code Here

    removeDebugAnnotations(cas, matchedType, ruleApplyType, blockApplyType);
    double applyAmount = 0;
    double triedAmount = 0;
    ae.process(cas);
    Feature innerApplyFeature = blockApplyType.getFeatureByBaseName("innerApply");
    Feature appliedFeature = ruleApplyType.getFeatureByBaseName("applied");
    Feature triedFeature = ruleApplyType.getFeatureByBaseName("tried");
    Feature elementFeature = ruleApplyType.getFeatureByBaseName("element");
    FSIterator<AnnotationFS> iterator = cas.getAnnotationIndex(blockApplyType).iterator();
    if (iterator.isValid()) {
      AnnotationFS fs = iterator.get();
      if (fs.getType().equals(blockApplyType)) {
        FeatureStructure featureValue = fs.getFeatureValue(innerApplyFeature);
View Full Code Here

  public CAS evaluate(CAS test, CAS run, Collection<String> excludedTypes, boolean includeSubtypes, boolean useAllTypes)
          throws CASRuntimeException, CASException {
    Type falsePositiveType = run.getTypeSystem().getType(ICasEvaluator.FALSE_POSITIVE);
    Type falseNegativeType = run.getTypeSystem().getType(ICasEvaluator.FALSE_NEGATIVE);
    Type truePositveType = run.getTypeSystem().getType(ICasEvaluator.TRUE_POSITIVE);
    Feature feature = falsePositiveType.getFeatureByBaseName(ICasEvaluator.ORIGINAL);
    List<Type> allTypes = test.getTypeSystem().getProperlySubsumedTypes(
            test.getTypeSystem().getTopType());
    List<Type> types = new ArrayList<Type>();

    TypeSystem typeSystem = test.getTypeSystem();
View Full Code Here

        Type range = feature.getRange();
        if (testTS.subsumes(annotationType, range)) {
          FeatureStructure valueTest = fs.getFeatureValue(feature);
          if (valueTest instanceof AnnotationFS) {
            AnnotationFS a1 = (AnnotationFS) valueTest;
            Feature feature2 = newFS.getType().getFeatureByBaseName(feature.getShortName());
            if (feature2 != null) {
              Type range2 = runTS.getType(range.getName());
              AnnotationFS createAnnotation = runCas.createAnnotation(range2, a1.getBegin(),
                      a1.getEnd());
              newFS.setFeatureValue(feature2, createAnnotation);
View Full Code Here

TOP

Related Classes of org.apache.uima.cas.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.