id++;
if (!pdg.isTree()) {
configLogger.info("\n[Warning: Sentence '" + id + "' cannot projectivize, because the dependency graph is not a tree]\n");
return;
}
DependencyNode deepestNonProjectiveNode;
initProjectivization(pdg);
if (rootAttachment == CoveredRootAttachment.IGNORE) {
if (markingStrategy != PseudoProjectiveEncoding.NONE) {
while (!pdg.isProjective()) {
if (liftingOrder == LiftingOrder.DEEPEST) {
deepestNonProjectiveNode = getDeepestNonProjectiveNode(pdg);
} else {
deepestNonProjectiveNode = getShortestNonProjectiveNode(pdg);
}
if (!attachCoveredRoots(pdg, deepestNonProjectiveNode)) {
nodeLifted.set(deepestNonProjectiveNode.getIndex(), true);
setHeadDeprel(deepestNonProjectiveNode, deepestNonProjectiveNode.getHead());
setPath(deepestNonProjectiveNode.getHead());
pdg.moveDependencyEdge(pdg.getDependencyNode(deepestNonProjectiveNode.getHead().getHead().getIndex()).getIndex(), deepestNonProjectiveNode.getIndex());
}
}
deattachCoveredRootsForProjectivization(pdg);
}
} else {
if (rootAttachment != CoveredRootAttachment.NONE) {
for (int index : pdg.getTokenIndices()) {
attachCoveredRoots(pdg, pdg.getTokenNode(index));
}
}
if (markingStrategy != PseudoProjectiveEncoding.NONE) {
while (!pdg.isProjective()) {
if (liftingOrder == LiftingOrder.DEEPEST) {
deepestNonProjectiveNode = getDeepestNonProjectiveNode(pdg);
} else {
deepestNonProjectiveNode = getShortestNonProjectiveNode(pdg);
}
nodeLifted.set(deepestNonProjectiveNode.getIndex(), true);
setHeadDeprel(deepestNonProjectiveNode, deepestNonProjectiveNode.getHead());
setPath(deepestNonProjectiveNode.getHead());
pdg.moveDependencyEdge(pdg.getDependencyNode(deepestNonProjectiveNode.getHead().getHead().getIndex()).getIndex(), deepestNonProjectiveNode.getIndex());
}
}
}
// collectTraceStatistics(pdg);
assignPseudoProjectiveDeprels(pdg);