public int preprocess(int signal) throws MaltChainedException {
if (taskName.equals("create")) {
boolean phrase = false;
boolean dependency = false;
ConfigurationDir configDir = (ConfigurationDir)flowChartinstance.getFlowChartRegistry(org.maltparserx.core.config.ConfigurationDir.class, idName);
DataFormatInstance dataFormatInstance = null;
DataFormatManager dataFormatManager = configDir.getDataFormatManager();
SymbolTableHandler symbolTables = configDir.getSymbolTables();
for (String key : configDir.getDataFormatInstanceKeys()) {
DataFormatInstance dfi = configDir.getDataFormatInstance(key);
if (dfi.getDataFormarSpec().getDataStructure() == DataStructure.PHRASE) {
phrase = true;
}
if (dfi.getDataFormarSpec().getDataStructure() == DataStructure.DEPENDENCY) {
dependency = true;
dataFormatInstance = dfi;
}
}
if (dependency == false && OptionManager.instance().getOptionValue(getOptionContainerIndex(), "config", "flowchart").toString().equals("learn")) {
dependency = true;
HashSet<Dependency> deps = dataFormatManager.getInputDataFormatSpec().getDependencies();
String nullValueStategy = OptionManager.instance().getOptionValue(getOptionContainerIndex(), "singlemalt", "null_value").toString();
for (Dependency dep : deps) {
dataFormatInstance = dataFormatManager.getDataFormatSpec(dep.getDependentOn()).createDataFormatInstance(symbolTables, nullValueStategy);
configDir.addDataFormatInstance(dataFormatManager.getOutputDataFormatSpec().getDataFormatName(), dataFormatInstance);
}
}
if (dependency == true && phrase == false) {
graph = new DependencyGraph(symbolTables);
flowChartinstance.addFlowChartRegistry(org.maltparserx.core.syntaxgraph.DependencyStructure.class, structureName, graph);
} else if (dependency == true && phrase == true) {
graph = new MappablePhraseStructureGraph(symbolTables);
final DataFormatInstance inFormat = configDir.getDataFormatInstance(dataFormatManager.getInputDataFormatSpec().getDataFormatName());
final DataFormatInstance outFormat = configDir.getDataFormatInstance(dataFormatManager.getOutputDataFormatSpec().getDataFormatName());
if (inFormat != null && outFormat != null) {
LosslessMapping mapping = null;
if (inFormat.getDataFormarSpec().getDataStructure() == DataStructure.DEPENDENCY) {
mapping = new LosslessMapping(inFormat, outFormat);