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);
}
}