setGuideName("ArcEager");
}
public GuideUserAction predict(DependencyStructure gold, ParserConfiguration config) throws MaltChainedException {
final NivreConfig nivreConfig = (NivreConfig)config;
final DependencyNode stackPeek = nivreConfig.getStack().peek();
final int stackPeekIndex = stackPeek.getIndex();
final int inputPeekIndex = nivreConfig.getInput().peek().getIndex();
if (!stackPeek.isRoot() && gold.getTokenNode(stackPeekIndex).getHead().getIndex() == inputPeekIndex) {
return updateActionContainers(ArcEager.LEFTARC, gold.getTokenNode(stackPeekIndex).getHeadEdge().getLabelSet());
} else if (gold.getTokenNode(inputPeekIndex).getHead().getIndex() == stackPeekIndex) {
return updateActionContainers(ArcEager.RIGHTARC, gold.getTokenNode(inputPeekIndex).getHeadEdge().getLabelSet());
} else if (!nivreConfig.isAllowReduce() && !stackPeek.hasHead()) {
return updateActionContainers(ArcEager.SHIFT, null);
} else if (gold.getTokenNode(inputPeekIndex).hasLeftDependent() &&
gold.getTokenNode(inputPeekIndex).getLeftmostDependent().getIndex() < stackPeekIndex) {
return updateActionContainers(ArcEager.REDUCE, null);
} else if (gold.getTokenNode(inputPeekIndex).getHead().getIndex() < stackPeekIndex &&