Package org.apache.uima.analysis_engine.annotator

Examples of org.apache.uima.analysis_engine.annotator.AnnotatorInitializationException


    lastResultSpec = null;
    lastDocument = null;
    try {
      stringParamValue = (String) getContext().getConfigParameterValue("StringParam");
    } catch (AnnotatorContextException e) {
      throw new AnnotatorInitializationException(e);
    }
  }
View Full Code Here


    lastResultSpec = null;
    lastDocument = null;
    try {
      stringParamValue = (String) getContext().getConfigParameterValue("StringParam");
    } catch (AnnotatorContextException e) {
      throw new AnnotatorInitializationException(e);
    }
  }
View Full Code Here

    lastResultSpec = null;
    lastDocument = null;
    try {
      stringParamValue = (String) getContext().getConfigParameterValue("StringParam");
    } catch (AnnotatorContextException e) {
      throw new AnnotatorInitializationException(e);
    }
  }
View Full Code Here

    lastResultSpec = null;
    lastDocument = null;
    try {
      stringParamValue = (String) getContext().getConfigParameterValue("StringParam");
    } catch (AnnotatorContextException e) {
      throw new AnnotatorInitializationException(e);
    }
  }
View Full Code Here

      logger.log(LOG_LEVEL, "the function " + functionName
              + " is trying to throw the following exception: " + functionError);
      if (functionError.equals("AnnotatorConfigurationException")) {
        throw new AnnotatorConfigurationException();
      } else if (functionError.equals("AnnotatorInitializationException")) {
        throw new AnnotatorInitializationException();
      } else {
        throwAnException(functionError);
      }
    }
  }
View Full Code Here

      int windowType = JCasUtil.getType(objClassName);
      return indexes.getAnnotationIndex(windowType).iterator();
    }
    catch (Exception e)
    {
      throw new AnnotatorInitializationException(e);
    }
  }
View Full Code Here

      logger.log(LOG_LEVEL, "the function " + functionName
              + " is trying to throw the following exception: " + functionError);
      if (functionError.equals("AnnotatorConfigurationException")) {
        throw new AnnotatorConfigurationException();
      } else if (functionError.equals("AnnotatorInitializationException")) {
        throw new AnnotatorInitializationException();
      } else {
        throwAnException(functionError);
      }
    }
  }
View Full Code Here

        spanFeatureStructureName);
    if (spanFeatureStructureType == null) {
      logger.logError(PARAM_DATA_BLOCK_FS + " '"
          + spanFeatureStructureName
          + "' specified, but does not exist: ");
      throw new AnnotatorInitializationException();
    }
    FSIndex dbIndex = tcas.getAnnotationIndex(spanFeatureStructureType);
    FSIterator spanIterator = dbIndex.iterator();
    while (spanIterator.hasNext()) {
      AnnotationFS enclosingSpanAnnotation = (AnnotationFS) spanIterator
View Full Code Here

        spanFeatureStructureName);
    if (spanFeatureStructureType == null) {
      logger.logError(PARAM_DATA_BLOCK_FS + " '"
          + spanFeatureStructureName
          + "' specified, but does not exist: ");
      throw new AnnotatorInitializationException();
    }
    FSIndex dbIndex = tcas.getAnnotationIndex(spanFeatureStructureType);
    FSIterator spanIterator = dbIndex.iterator();
    while (spanIterator.hasNext()) {
      AnnotationFS enclosingSpanAnnotation = (AnnotationFS) spanIterator
View Full Code Here

    tokenType = typeSystem.getType(tokenAnnotationName);
    if (tokenType == null) {
      logger.logError(PARAM_TOKENANNOTATION + " '" + tokenAnnotationName
              + "' specified, but does not exist");
      throw new AnnotatorInitializationException();
    }

    if ((tokenTextFeatureName == null) || (tokenTextFeatureName.equals(""))) {
      tokenTextFeature = null;
    } else {
      tokenTextFeature = tokenType.getFeatureByBaseName(tokenTextFeatureName);
      if (tokenTextFeature == null) {
        logger.logError(PARAM_TOKENTEXTFEATURENAME + " '" + tokenTextFeatureName
                + "' specified, but does not exist for type: " + tokenType.getName());
        throw new AnnotatorInitializationException();
      }
    }

    if ((tokenClassWriteBackFeatureNames != null) && (tokenClassWriteBackFeatureNames.length > 0)) {
      tokenClassWriteBackFeatures = new Feature[tokenClassWriteBackFeatureNames.length];
      for (int i = 0; i < tokenClassWriteBackFeatureNames.length; i++) {
        tokenClassWriteBackFeatures[i] = tokenType
                .getFeatureByBaseName(tokenClassWriteBackFeatureNames[i]);
        if (tokenClassWriteBackFeatures[i] == null) {
          logger.logError(PARAM_TOKENCLASSWRITEBACKFEATURENAMES + "[" + i + "] '"
                  + tokenClassWriteBackFeatureNames[i]
                  + "' specified, but does not exist for type: " + tokenType.getName());
          throw new AnnotatorInitializationException();
        }
      }
    } else {
      tokenClassWriteBackFeatures = null;
    }

    spanFeatureStructureType = typeSystem.getType(spanFeatureStructureName);
    if (spanFeatureStructureType == null) {
      logger.logError(PARAM_DATA_BLOCK_FS + " '" + spanFeatureStructureName
              + "' specified, but does not exist for type: " + tokenType.getName());
      throw new AnnotatorInitializationException();
    }

    resultAnnotationType = typeSystem.getType(resultAnnotationName);
    if (resultAnnotationType == null) {
      logger.logError(PARAM_ANNOTATION_NAME + " '" + resultAnnotationName
              + "' specified, but does not exist");
      throw new AnnotatorInitializationException();
    }

    if ((resultEnclosingSpanName == null) || (resultEnclosingSpanName.equals(""))) {
      resultEnclosingSpan = null;
    } else {
      resultEnclosingSpan = resultAnnotationType.getFeatureByBaseName(resultEnclosingSpanName);
      if (resultEnclosingSpan == null) {
        logger.logError(PARAM_ENCLOSINGSPAN + " '" + resultEnclosingSpanName
                + "' specified, but does not exist for type: " + resultAnnotationType.getName());
        throw new AnnotatorInitializationException();
      }
    }

    if ((resultMatchedTextFeatureName == null) || (resultMatchedTextFeatureName.equals(""))) {
      resultMatchedTextFeature = null;
    } else {
      resultMatchedTextFeature = resultAnnotationType
              .getFeatureByBaseName(resultMatchedTextFeatureName);
      if (resultMatchedTextFeature == null) {
        logger.logError(PARAM_MATCHEDFEATURE + " '" + resultMatchedTextFeatureName
                + "' specified, but does not exist for type: " + resultAnnotationType.getName());
        throw new AnnotatorInitializationException();
      }
    }

    if ((matchedTokensFeatureName == null) || (matchedTokensFeatureName.equals(""))) {
      matchedTokensFeature = null;
    } else {
      matchedTokensFeature = resultAnnotationType.getFeatureByBaseName(matchedTokensFeatureName);
      if (matchedTokensFeature == null) {
        logger.logError(PARAM_MATCHEDTOKENSFEATURENAME + " '" + matchedTokensFeatureName
                + "' specified, but does not exist for type: " + resultAnnotationType.getName());
        throw new AnnotatorInitializationException();
      }
    }

    int numFeatures = featureNames.length;
    features = new Feature[numFeatures];

    for (int i = 0; i < numFeatures; i++) {
      features[i] = resultAnnotationType.getFeatureByBaseName(featureNames[i]);
      if (features[i] == null) {
        logger.logError(PARAM_FEATURE_LIST + "[" + i + "] '" + featureNames[i]
                + "' specified, but does not exist for type: " + resultAnnotationType.getName());
        // System.err.println (PARAM_FEATURE_LIST + "[" + i + "] '" +
        // featureNames[i] + "' specified, but does not exist for type:
        // " + resultAnnotationType.getName());
        throw new AnnotatorInitializationException();
      }

    }

    try {
      tokenFilter.initTypes(typeSystem);
    } catch (UnknownTypeException e) {
      throw new AnnotatorInitializationException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.analysis_engine.annotator.AnnotatorInitializationException

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.