// Creates a dependency graph
if (tokens == null || tokens.length == 0) {
throw new MaltChainedException("Nothing to convert. ");
}
DependencyStructure outputGraph = new DependencyGraph(symbolTables);
for (int i = 0; i < tokens.length; i++) {
Iterator<ColumnDescription> columns = dataFormatInstance.iterator();
DependencyNode node = outputGraph.addDependencyNode(i+1);
String[] items = tokens[i].split("\t");
Edge edge = null;
for (int j = 0; j < items.length; j++) {
if (columns.hasNext()) {
ColumnDescription column = columns.next();
if (column.getCategory() == ColumnDescription.INPUT && node != null) {
outputGraph.addLabel(node, column.getName(), items[j]);
} else if (column.getCategory() == ColumnDescription.HEAD) {
if (column.getCategory() != ColumnDescription.IGNORE && !items[j].equals("_")) {
edge = ((DependencyStructure)outputGraph).addDependencyEdge(Integer.parseInt(items[j]), i+1);
}
} else if (column.getCategory() == ColumnDescription.DEPENDENCY_EDGE_LABEL && edge != null) {
outputGraph.addLabel(edge, column.getName(), items[j]);
}
}
}
}
outputGraph.setDefaultRootEdgeLabel(outputGraph.getSymbolTables().getSymbolTable("DEPREL"), "ROOT");
return outputGraph;
}