public void loadParReader(URL specModelURL, String markingStrategy, String coveredRoot) throws MaltChainedException {
if (specModelURL == null) {
throw new FeatureException("The URL to the feature specification model is missing or not well-formed. ");
}
FeatureSpecReader specReader = null;
String urlSuffix = specModelURL.toString().substring(specModelURL.toString().length()-3);
urlSuffix = Character.toUpperCase(urlSuffix.charAt(0)) + urlSuffix.substring(1);
try {
Class<?> clazz = Class.forName("org.maltparserx.core.feature.spec.reader."+urlSuffix+"Reader");
specReader = (FeatureSpecReader)clazz.newInstance();
} catch (InstantiationException e) {
throw new FeatureException("Could not initialize the feature specification reader to read the specification file: "+specModelURL.toString(), e);
} catch (IllegalAccessException e) {
throw new FeatureException("Could not initialize the feature specification reader to read the specification file: "+specModelURL.toString(), e);
} catch (ClassNotFoundException e) {
throw new FeatureException("Could not find the feature specification reader to read the specification file: "+specModelURL.toString(), e);
}
specReaderMap.put(specModelURL, specReader);
if (specReader instanceof ParReader) {
if (markingStrategy.equalsIgnoreCase("head") || markingStrategy.equalsIgnoreCase("path") || markingStrategy.equalsIgnoreCase("head+path")) {
((ParReader)specReader).setPplifted(true);
}
if (markingStrategy.equalsIgnoreCase("path") || markingStrategy.equalsIgnoreCase("head+path")) {
((ParReader)specReader).setPppath(true);
}
if (!coveredRoot.equalsIgnoreCase("none")) {
((ParReader)specReader).setPpcoveredRoot(true);
}
}
currentSpecModelURL = new ArrayList<SpecificationModel>();
specModelKeyMap.put(specModelURL, currentSpecModelURL);
specReader.load(specModelURL, this);
}