}
/** Adds the required component factories to a local Carrot2 controller. */
private void addComponentFactories() throws DuplicatedKeyException {
// * <input component-key="input-nutch" />
LocalComponentFactory nutchInputFactory = new LocalComponentFactory() {
public LocalComponent getInstance() {
return new NutchInputComponent(defaultLanguage);
}
};
controller.addLocalComponentFactory("input-nutch", nutchInputFactory);
// * <filter component-key="filter-lingo" />
LocalComponentFactory lingoFactory = new LocalComponentFactory() {
public LocalComponent getInstance() {
final HashMap defaults = new HashMap();
// These are adjustments settings for the clustering algorithm.
// If you try the live WebStart demo of Carrot2 you can see how they affect
// the final clustering: http://www.carrot2.org
defaults.put("lsi.threshold.clusterAssignment", "0.150");
defaults.put("lsi.threshold.candidateCluster", "0.775");
// Initialize a new Lingo clustering component.
ArrayList languageList = new ArrayList(languages.length);
for (int i = 0; i < languages.length; i++) {
final String lcode = languages[i];
try {
final Language lang = AllKnownLanguages.getLanguageForIsoCode(lcode);
if (lang == null) {
logger.warn("Language not supported in Carrot2: " + lcode);
} else {
languageList.add(lang);
logger.debug("Language loaded: " + lcode);
}
} catch (Throwable t) {
logger.warn("Language could not be loaded: " + lcode, t);
}
}
return new LingoLocalFilterComponent(
(Language []) languageList.toArray(new Language [languageList.size()]), defaults);
}
};
controller.addLocalComponentFactory("filter-lingo", lingoFactory);
// * <output component-key="output-clustersConsumer" />
LocalComponentFactory clusterConsumerOutputFactory = new LocalComponentFactory() {
public LocalComponent getInstance() {
return new ArrayOutputComponent();
}
};
controller.addLocalComponentFactory("output-array",