//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.maltparser.parser.history.action.GuideUserAction getDeterministicAction(org.maltparser.parser.history.GuideUserHistory history, org.maltparser.parser.ParserConfiguration config) throws org.maltparser.core.exception.MaltChainedException public override GuideUserAction getDeterministicAction(GuideUserHistory history, ParserConfiguration config) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final NivreConfig nivreConfig = (NivreConfig)config; NivreConfig nivreConfig = (NivreConfig)config; if (!nivreConfig.EnforceTree) { if (!nivreConfig.AllowRoot && nivreConfig.Stack.Peek().Root) { return(updateActionContainers(history, SHIFT, null)); } } else { //Added if (!nivreConfig.AllowRoot && nivreConfig.Stack.Peek().Root&& !nivreConfig.End) { return(updateActionContainers(history, SHIFT, null)); } if (nivreConfig.Input.Count == 0 && nivreConfig.Stack.Peek().hasHead()) { return(updateActionContainers(history, REDUCE, null)); } if (nivreConfig.Input.Count == 0 && !nivreConfig.Stack.Peek().hasHead()) { return(updateActionContainers(history, UNSHIFT, null)); } } return(null); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.maltparser.parser.history.action.GuideUserAction getDeterministicAction(org.maltparser.parser.history.GuideUserHistory history, org.maltparser.parser.ParserConfiguration config) throws org.maltparser.core.exception.MaltChainedException public override GuideUserAction getDeterministicAction(GuideUserHistory history, ParserConfiguration config) { NivreConfig nivreConfig = (NivreConfig)config; if (!nivreConfig.AllowRoot && nivreConfig.Stack.Peek().Root) { return(updateActionContainers(history, SHIFT, null)); } return(null); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void update(NivreConfig config) throws org.maltparser.core.exception.MaltChainedException private void update(NivreConfig config) { if (subFunction == NivreSubFunction.STACK) { address.Address = config.getStackNode(index); } else if (subFunction == NivreSubFunction.INPUT) { address.Address = config.getInputNode(index); } else { address.Address = null; } }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null) { return(false); } if (GetType() != obj.GetType()) { return(false); } NivreConfig that = (NivreConfig)obj; if (stack.Count != that.Stack.Count) { return(false); } if (input.Count != that.Input.Count) { return(false); } if (dependencyGraph.NEdges() != that.DependencyGraph.NEdges()) { return(false); } for (int i = 0; i < stack.Count; i++) { //JAVA TO C# CONVERTER TODO TASK: There is no direct .NET Stack equivalent to Java Stack methods based on internal indexing: if (stack.get(i).Index != that.Stack.get(i).Index) { return(false); } } for (int i = 0; i < input.Count; i++) { //JAVA TO C# CONVERTER TODO TASK: There is no direct .NET Stack equivalent to Java Stack methods based on internal indexing: if (input.get(i).Index != that.Input.get(i).Index) { return(false); } } return(dependencyGraph.Edges.Equals(that.DependencyGraph.Edges)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void initialize(org.maltparser.parser.ParserConfiguration parserConfiguration) throws org.maltparser.core.exception.MaltChainedException public virtual void initialize(ParserConfiguration parserConfiguration) { if (parserConfiguration != null) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final NivreConfig nivreConfig = (NivreConfig)parserConfiguration; NivreConfig nivreConfig = (NivreConfig)parserConfiguration; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.Stack<org.maltparser.core.syntaxgraph.node.DependencyNode> sourceStack = nivreConfig.getStack(); Stack <DependencyNode> sourceStack = nivreConfig.Stack; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.Stack<org.maltparser.core.syntaxgraph.node.DependencyNode> sourceInput = nivreConfig.getInput(); Stack <DependencyNode> sourceInput = nivreConfig.Input; DependencyGraph = nivreConfig.DependencyGraph; for (int i = 0, n = sourceStack.Count; i < n; i++) { //JAVA TO C# CONVERTER TODO TASK: There is no direct .NET Stack equivalent to Java Stack methods based on internal indexing: stack.Push(dependencyGraph.GetDependencyNode(sourceStack.get(i).Index)); } for (int i = 0, n = sourceInput.Count; i < n; i++) { //JAVA TO C# CONVERTER TODO TASK: There is no direct .NET Stack equivalent to Java Stack methods based on internal indexing: input.Push(dependencyGraph.GetDependencyNode(sourceInput.get(i).Index)); } } else { stack.Push(dependencyGraph.DependencyRoot); for (int i = dependencyGraph.HighestTokenIndex; i > 0; i--) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.maltparser.core.syntaxgraph.node.DependencyNode node = dependencyGraph.getDependencyNode(i); DependencyNode node = dependencyGraph.GetDependencyNode(i); if (node != null && !node.hasHead()) { // added !node.hasHead() input.Push(node); } } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.maltparser.parser.history.action.GuideUserAction predict(org.maltparser.core.syntaxgraph.DependencyStructure gold, org.maltparser.parser.ParserConfiguration config) throws org.maltparser.core.exception.MaltChainedException public override GuideUserAction predict(IDependencyStructure gold, ParserConfiguration config) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final NivreConfig nivreConfig = (NivreConfig)config; NivreConfig nivreConfig = (NivreConfig)config; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.maltparser.core.syntaxgraph.node.DependencyNode stackPeek = nivreConfig.getStack().peek(); DependencyNode stackPeek = nivreConfig.Stack.Peek(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int stackPeekIndex = stackPeek.getIndex(); int stackPeekIndex = stackPeek.Index; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int inputPeekIndex = nivreConfig.getInput().peek().getIndex(); int inputPeekIndex = nivreConfig.Input.Peek().Index; if (!stackPeek.Root && gold.GetTokenNode(stackPeekIndex).Head.Index == inputPeekIndex) { return(updateActionContainers(ArcEager.LEFTARC, gold.GetTokenNode(stackPeekIndex).HeadEdge.LabelSet)); } else if (gold.GetTokenNode(inputPeekIndex).Head.Index == stackPeekIndex) { return(updateActionContainers(ArcEager.RIGHTARC, gold.GetTokenNode(inputPeekIndex).HeadEdge.LabelSet)); } else if (!nivreConfig.AllowReduce && !stackPeek.hasHead()) { return(updateActionContainers(ArcEager.SHIFT, null)); } else if (gold.GetTokenNode(inputPeekIndex).hasLeftDependent() && gold.GetTokenNode(inputPeekIndex).LeftmostDependent.Index < stackPeekIndex) { return(updateActionContainers(ArcEager.REDUCE, null)); } else if (gold.GetTokenNode(inputPeekIndex).Head.Index < stackPeekIndex && (!gold.GetTokenNode(inputPeekIndex).Head.Root || nivreConfig.AllowRoot)) { return(updateActionContainers(ArcEager.REDUCE, null)); } else { return(updateActionContainers(ArcEager.SHIFT, null)); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void apply(org.maltparser.parser.history.action.GuideUserAction currentAction, org.maltparser.parser.ParserConfiguration config) throws org.maltparser.core.exception.MaltChainedException public override void apply(GuideUserAction currentAction, ParserConfiguration config) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final NivreConfig nivreConfig = (NivreConfig)config; NivreConfig nivreConfig = (NivreConfig)config; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.Stack<org.maltparser.core.syntaxgraph.node.DependencyNode> stack = nivreConfig.getStack(); Stack <DependencyNode> stack = nivreConfig.Stack; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.Stack<org.maltparser.core.syntaxgraph.node.DependencyNode> input = nivreConfig.getInput(); Stack <DependencyNode> input = nivreConfig.Input; currentAction.getAction(actionContainers); Edge e = null; switch (transActionContainer.ActionCode) { case LEFTARC: e = nivreConfig.DependencyStructure.AddDependencyEdge(input.Peek().Index, stack.Peek().Index); addEdgeLabels(e); stack.Pop(); break; case RIGHTARC: e = nivreConfig.DependencyStructure.AddDependencyEdge(stack.Peek().Index, input.Peek().Index); addEdgeLabels(e); input.Pop(); if (!stack.Peek().Root) { input.Push(stack.Pop()); } break; default: stack.Push(input.Pop()); // SHIFT break; } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean permissible(org.maltparser.parser.history.action.GuideUserAction currentAction, org.maltparser.parser.ParserConfiguration config) throws org.maltparser.core.exception.MaltChainedException public override bool permissible(GuideUserAction currentAction, ParserConfiguration config) { currentAction.getAction(actionContainers); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int trans = transActionContainer.getActionCode(); int trans = transActionContainer.ActionCode; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final NivreConfig nivreConfig = (NivreConfig)config; NivreConfig nivreConfig = (NivreConfig)config; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.maltparser.core.syntaxgraph.node.DependencyNode stackPeek = nivreConfig.getStack().peek(); DependencyNode stackPeek = nivreConfig.Stack.Peek(); if ((trans == LEFTARC || trans == RIGHTARC) && !ActionContainersLabeled) { return(false); } if ((trans == LEFTARC || trans == REDUCE) && stackPeek.Root) { return(false); } if (trans == LEFTARC && stackPeek.hasHead()) { return(false); } if (trans == REDUCE && !stackPeek.hasHead() && !nivreConfig.AllowReduce) { return(false); } //Added if (trans == SHIFT && nivreConfig.EnforceTree && nivreConfig.End) { return(false); } return(true); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.maltparser.parser.history.action.GuideUserAction predict(org.maltparser.core.syntaxgraph.DependencyStructure gold, org.maltparser.parser.ParserConfiguration config) throws org.maltparser.core.exception.MaltChainedException public override GuideUserAction predict(IDependencyStructure gold, ParserConfiguration config) { NivreConfig nivreConfig = (NivreConfig)config; DependencyNode stackPeek = nivreConfig.Stack.Peek(); int stackPeekIndex = stackPeek.Index; int inputPeekIndex = nivreConfig.Input.Peek().Index; if (!nivreConfig.AllowRoot && stackPeek.Root) { return(updateActionContainers(ArcStandard.SHIFT, null)); } if (!stackPeek.Root && gold.GetTokenNode(stackPeekIndex).Head.Index == inputPeekIndex) { return(updateActionContainers(ArcStandard.LEFTARC, gold.GetTokenNode(stackPeekIndex).HeadEdge.LabelSet)); } else if (gold.GetTokenNode(inputPeekIndex).Head.Index == stackPeekIndex && checkRightDependent(gold, nivreConfig.DependencyGraph, inputPeekIndex)) { return(updateActionContainers(ArcStandard.RIGHTARC, gold.GetTokenNode(inputPeekIndex).HeadEdge.LabelSet)); } else { return(updateActionContainers(ArcStandard.SHIFT, null)); } }