try {
String[] mappingStrings = null;
mappingStrings = (String[]) aContext.getConfigParameterValue(MAPPINGS_PARAM);
if (mappingStrings == null) {
throw new AnnotatorConfigurationException();
}
loadMappings(mappingStrings);
String modelDirName = (String) aContext.getConfigParameterValue(MODEL_DIR_PARAM);
File modelDir = new File(modelDirName);
if (!modelDir.isDirectory()) {
throw new AnnotatorConfigurationException();
}
File[] modelFiles = modelDir.listFiles(new modelFileFilter());
numNefs = modelFiles.length;
nameFinders = new NameFinder[numNefs];
nameFinderLabels = new String[numNefs];
neAnnotationMakers = new Constructor[numNefs];
for (int i = 0; i < numNefs; i++) {
String modelName = modelFiles[i].getName();
System.out.print("Loading model: " + modelName + "...");
nameFinders[i] = new NameFinder(new SuffixSensitiveGISModelReader(modelFiles[i]).getModel());
int nameStart = modelName.lastIndexOf(System.getProperty("file.separator")) + 1;
int nameEnd = modelName.indexOf('.', nameStart);
if (nameEnd == -1) {
nameEnd = modelName.length();
}
nameFinderLabels[i] = modelName.substring(nameStart, nameEnd);
Constructor annotationMaker;
if ((annotationMaker = (Constructor) labelMap.get(nameFinderLabels[i])) == null) {
throw new AnnotatorConfigurationException();
}
neAnnotationMakers[i] = annotationMaker;
System.out.println("done");
}