}
public void initDataFormat() throws MaltChainedException {
String inputFormatName = OptionManager.instance().getOptionValue(containerIndex, "input", "format").toString().trim();
String outputFormatName = OptionManager.instance().getOptionValue(containerIndex, "output", "format").toString().trim();
final URLFinder f = new URLFinder();
if (configDirectory != null && configDirectory.exists()) {
if (outputFormatName.length() == 0 || inputFormatName.equals(outputFormatName)) {
URL inputFormatURL = f.findURLinJars(inputFormatName);
if (inputFormatURL != null) {
outputFormatName = inputFormatName = this.copyToConfig(inputFormatURL);
} else {
outputFormatName = inputFormatName = this.copyToConfig(inputFormatName);
}
} else {
URL inputFormatURL = f.findURLinJars(inputFormatName);
if (inputFormatURL != null) {
inputFormatName = this.copyToConfig(inputFormatURL);
} else {
inputFormatName = this.copyToConfig(inputFormatName);
}
URL outputFormatURL = f.findURLinJars(outputFormatName);
if (inputFormatURL != null) {
outputFormatName = this.copyToConfig(outputFormatURL);
} else {
outputFormatName = this.copyToConfig(outputFormatName);
}
}
OptionManager.instance().overloadOptionValue(containerIndex, "input", "format", inputFormatName);
} else {
if (outputFormatName.length() == 0) {
outputFormatName = inputFormatName;
}
}
dataFormatInstances = new HashMap<String, DataFormatInstance>(3);
inputFormatURL = findURL(inputFormatName);
outputFormatURL = findURL(outputFormatName);
if (outputFormatURL != null) {
try {
InputStream is = outputFormatURL.openStream();
} catch (FileNotFoundException e) {
outputFormatURL = f.findURL(outputFormatName);
} catch (IOException e) {
outputFormatURL = f.findURL(outputFormatName);
}
} else {
outputFormatURL = f.findURL(outputFormatName);
}
dataFormatManager = new DataFormatManager(inputFormatURL, outputFormatURL);
String mode = OptionManager.instance().getOptionValue(containerIndex, "config", "flowchart").toString().trim();
if (mode.equals("parse")) {
symbolTables = new TrieSymbolTableHandler(TrieSymbolTableHandler.ADD_NEW_TO_TMP_STORAGE);
// symbolTables = new TrieSymbolTableHandler(TrieSymbolTableHandler.ADD_NEW_TO_TRIE);
} else {
symbolTables = new TrieSymbolTableHandler(TrieSymbolTableHandler.ADD_NEW_TO_TRIE);
}
if (dataFormatManager.getInputDataFormatSpec().getDataStructure() == DataStructure.PHRASE) {
if (mode.equals("learn")) {
Set<Dependency> deps = dataFormatManager.getInputDataFormatSpec().getDependencies();
for (Dependency dep : deps) {
URL depFormatURL = f.findURLinJars(dep.getUrlString());
if (depFormatURL != null) {
this.copyToConfig(depFormatURL);
} else {
this.copyToConfig(dep.getUrlString());
}