Package org.apache.uima.analysis_engine.annotator

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


         int windowType;
         try {
            windowType = JCasUtil.getType( objClassName );
         } catch ( IllegalArgumentException iaE ) {
            // thrown by JCasUtil.getType()
            throw new AnnotatorInitializationException( iaE );
         }
         return indexes.getAnnotationIndex( windowType ).iterator();
      } catch ( Exception e ) {
         // TODO specify exceptions, get rid of the catch for "Exception"
         throw new AnnotatorInitializationException( e );
      }
   }
View Full Code Here


  private LookupToken annoToLookupToken(Annotation bta)
      throws AnnotatorInitializationException {
    try {
      return (LookupToken) lookupTokenAdapterCtor.newInstance(bta);
    } catch (InvocationTargetException e) {
      throw new AnnotatorInitializationException(e);
    } catch (IllegalArgumentException e) {
      throw new AnnotatorInitializationException(e);
    } catch (InstantiationException e) {
      throw new AnnotatorInitializationException(e);
    } catch (IllegalAccessException e) {
      throw new AnnotatorInitializationException(e);
    }
  }
View Full Code Here

         int windowType;
         try {
            windowType = JCasUtil.getType( objClassName );
         } catch ( IllegalArgumentException iaE ) {
            // thrown by JCasUtil.getType()
            throw new AnnotatorInitializationException( iaE );
         }
         return indexes.getAnnotationIndex( windowType ).iterator();
      } catch ( Exception e ) {
         // TODO specify exceptions, get rid of the catch for "Exception"
         throw new AnnotatorInitializationException( e );
      }
   }
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

         int windowType;
         try {
            windowType = JCasUtil.getType( objClassName );
         } catch ( IllegalArgumentException iaE ) {
            // thrown by JCasUtil.getType()
            throw new AnnotatorInitializationException( iaE );
         }
         return indexes.getAnnotationIndex( windowType ).iterator();
      } catch ( Exception e ) {
         // TODO specify exceptions, get rid of the catch for "Exception"
         throw new AnnotatorInitializationException( e );
      }
   }
View Full Code Here

    try {
      LvgCmdApiResource lvgResource = (LvgCmdApiResource) context
          .getResourceObject(LVGCMDAPI_RESRC_KEY);

      if (lvgResource == null)
        throw new AnnotatorInitializationException(new Exception(
            "Unable to locate resource with key="
                + LVGCMDAPI_RESRC_KEY + "."));

      lvgCmd = lvgResource.getLvg();
View Full Code Here

      this.stemmers.put("pt", new portugueseStemmer());
      this.stemmers.put("ru", new russianStemmer());
      this.stemmers.put("es", new spanishStemmer());
      this.stemmers.put("sw", new swedishStemmer());
    } catch (Exception ex) {
      throw new AnnotatorInitializationException(ex);
    }

    this.logger.log(Level.INFO, "Snowball annotator successfully initialized");
  }
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

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.