use of org.apache.stanbol.entityhub.indexing.core.normaliser.DefaultNormaliser in project stanbol by apache.
the class IndexingConfig method initNormaliser.
private void initNormaliser() {
Object value = configuration.get(IndexingConstants.KEY_SCORE_NORMALIZER);
if (value == null) {
this.scoreNormaliser = new DefaultNormaliser();
} else {
ScoreNormaliser normaliser = null;
ScoreNormaliser last = null;
List<ConfigEntry> configs = parseConfigEntries(value.toString());
for (int i = configs.size() - 1; i >= 0; i--) {
last = normaliser;
normaliser = null;
ConfigEntry config = configs.get(i);
try {
normaliser = (ScoreNormaliser) Class.forName(config.getClassName()).newInstance();
} catch (Exception e) {
throw new IllegalArgumentException("Invalid Normaliser configuration '" + config.getConfigString() + "'!", e);
}
Map<String, Object> normaliserConfig = getComponentConfig(config, normaliser.getClass().getSimpleName(), config.getParams().containsKey(CONFIG_PARAM));
//add also the directly provided parameters
normaliserConfig.putAll(config.getParams());
if (last != null) {
normaliserConfig.put(ScoreNormaliser.CHAINED_SCORE_NORMALISER, last);
}
normaliser.setConfiguration(normaliserConfig);
}
//set the normaliser!
this.scoreNormaliser = normaliser;
}
}
Aggregations