//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) { StackConfig config = (StackConfig)parserConfiguration; Stack <DependencyNode> sourceStack = config.Stack; Stack <DependencyNode> sourceInput = config.Input; DependencyGraph = config.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()) { 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 configuration) throws org.maltparser.core.exception.MaltChainedException public override GuideUserAction predict(IDependencyStructure gold, ParserConfiguration configuration) { StackConfig config = (StackConfig)configuration; Stack <DependencyNode> stack = config.Stack; if (stack.Count < 2) { return(updateActionContainers(Projective.SHIFT, null)); } else { //JAVA TO C# CONVERTER TODO TASK: There is no direct .NET Stack equivalent to Java Stack methods based on internal indexing: DependencyNode left = stack.get(stack.Count - 2); int leftIndex = left.Index; //JAVA TO C# CONVERTER TODO TASK: There is no direct .NET Stack equivalent to Java Stack methods based on internal indexing: int rightIndex = stack.get(stack.Count - 1).Index; if (!left.Root && gold.GetTokenNode(leftIndex).Head.Index == rightIndex) { return(updateActionContainers(Projective.LEFTARC, gold.GetTokenNode(leftIndex).HeadEdge.LabelSet)); } else if (gold.GetTokenNode(rightIndex).Head.Index == leftIndex && checkRightDependent(gold, config.DependencyGraph, rightIndex)) { return(updateActionContainers(Projective.RIGHTARC, gold.GetTokenNode(rightIndex).HeadEdge.LabelSet)); } else { return(updateActionContainers(Projective.SHIFT, null)); } // Solve the problem with non-projective input. } }
//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 configuration) throws org.maltparser.core.exception.MaltChainedException public override bool permissible(GuideUserAction currentAction, ParserConfiguration configuration) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final StackConfig config = (StackConfig)configuration; StackConfig config = (StackConfig)configuration; 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; if ((trans == LEFTARC || trans == RIGHTARC) && !ActionContainersLabeled) { return(false); } //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 = config.getStack(); Stack <DependencyNode> stack = config.Stack; if ((trans == LEFTARC || trans == RIGHTARC) && stack.Count < 2) { return(false); } //JAVA TO C# CONVERTER TODO TASK: There is no direct .NET Stack equivalent to Java Stack methods based on internal indexing: if (trans == LEFTARC && stack.get(stack.Count - 2).Root) { return(false); } if (trans == SHIFT && config.Input.Count == 0) { return(false); } return(true); }
//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 configuration) throws org.maltparser.core.exception.MaltChainedException public override void apply(GuideUserAction currentAction, ParserConfiguration configuration) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final StackConfig config = (StackConfig)configuration; StackConfig config = (StackConfig)configuration; //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 = config.getStack(); Stack <DependencyNode> stack = config.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 = config.getInput(); Stack <DependencyNode> input = config.Input; currentAction.getAction(actionContainers); Edge e = null; DependencyNode head = null; DependencyNode dep = null; switch (transActionContainer.ActionCode) { case LEFTARC: head = stack.Pop(); dep = stack.Pop(); e = config.DependencyStructure.AddDependencyEdge(head.Index, dep.Index); addEdgeLabels(e); stack.Push(head); break; case RIGHTARC: dep = stack.Pop(); e = config.DependencyStructure.AddDependencyEdge(stack.Peek().Index, dep.Index); addEdgeLabels(e); break; case SWAP: dep = stack.Pop(); input.Push(stack.Pop()); stack.Push(dep); config.lookaheadIncrement(); break; default: if (input.Count == 0) { stack.Pop(); } else { stack.Push(input.Pop()); // SHIFT } config.lookaheadDecrement(); break; } }
//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 configuration) throws org.maltparser.core.exception.MaltChainedException public override GuideUserAction predict(IDependencyStructure gold, ParserConfiguration configuration) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final StackConfig config = (StackConfig)configuration; StackConfig config = (StackConfig)configuration; //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 = config.getStack(); Stack <DependencyNode> stack = config.Stack; if (!swapArrayActive) { createSwapArray(gold); swapArrayActive = true; } if (stack.Count < 2) { return(updateActionContainers(NonProjective.SHIFT, null)); } else { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.maltparser.core.syntaxgraph.node.DependencyNode left = stack.get(stack.size()-2); //JAVA TO C# CONVERTER TODO TASK: There is no direct .NET Stack equivalent to Java Stack methods based on internal indexing: DependencyNode left = stack.get(stack.Count - 2); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.maltparser.core.syntaxgraph.node.DependencyNode right = stack.get(stack.size() - 1); //JAVA TO C# CONVERTER TODO TASK: There is no direct .NET Stack equivalent to Java Stack methods based on internal indexing: DependencyNode right = stack.get(stack.Count - 1); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int leftIndex = left.getIndex(); int leftIndex = left.Index; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int rightIndex = right.getIndex(); int rightIndex = right.Index; if (swapArray[leftIndex] > swapArray[rightIndex] && necessarySwap(gold, config.DependencyGraph, right, config.Input)) { return(updateActionContainers(NonProjective.SWAP, null)); } else if (!left.Root && gold.GetTokenNode(leftIndex).Head.Index == rightIndex && nodeComplete(gold, config.DependencyGraph, leftIndex)) { return(updateActionContainers(NonProjective.LEFTARC, gold.GetTokenNode(leftIndex).HeadEdge.LabelSet)); } else if (gold.GetTokenNode(rightIndex).Head.Index == leftIndex && nodeComplete(gold, config.DependencyGraph, rightIndex)) { return(updateActionContainers(NonProjective.RIGHTARC, gold.GetTokenNode(rightIndex).HeadEdge.LabelSet)); } else { return(updateActionContainers(NonProjective.SHIFT, null)); } } }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj == null) { return(false); } if (GetType() != obj.GetType()) { return(false); } StackConfig that = (StackConfig)obj; if (lookahead != that.lookahead) { return(false); } 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: private void update(StackConfig config) throws org.maltparser.core.exception.MaltChainedException private void update(StackConfig config) { if (subFunction == StackSubFunction.STACK) { address.Address = config.getStackNode(index); } else if (subFunction == StackSubFunction.LOOKAHEAD) { address.Address = config.getLookaheadNode(index); } else if (subFunction == StackSubFunction.INPUT) { address.Address = config.getInputNode(index); } else { address.Address = null; } }
//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 configuration) throws org.maltparser.core.exception.MaltChainedException public override GuideUserAction predict(IDependencyStructure gold, ParserConfiguration configuration) { StackConfig config = (StackConfig)configuration; Stack <DependencyNode> stack = config.Stack; if (!swapArrayActive) { createSwapArray(gold); swapArrayActive = true; } GuideUserAction action = null; if (stack.Count < 2) { action = updateActionContainers(NonProjective.SHIFT, null); } else { //JAVA TO C# CONVERTER TODO TASK: There is no direct .NET Stack equivalent to Java Stack methods based on internal indexing: DependencyNode left = stack.get(stack.Count - 2); int leftIndex = left.Index; //JAVA TO C# CONVERTER TODO TASK: There is no direct .NET Stack equivalent to Java Stack methods based on internal indexing: int rightIndex = stack.get(stack.Count - 1).Index; if (swapArray[leftIndex] > swapArray[rightIndex]) { action = updateActionContainers(NonProjective.SWAP, null); } else if (!left.Root && gold.GetTokenNode(leftIndex).Head.Index == rightIndex && nodeComplete(gold, config.DependencyGraph, leftIndex)) { action = updateActionContainers(NonProjective.LEFTARC, gold.GetTokenNode(leftIndex).HeadEdge.LabelSet); } else if (gold.GetTokenNode(rightIndex).Head.Index == leftIndex && nodeComplete(gold, config.DependencyGraph, rightIndex)) { action = updateActionContainers(NonProjective.RIGHTARC, gold.GetTokenNode(rightIndex).HeadEdge.LabelSet); } else { action = updateActionContainers(NonProjective.SHIFT, null); } } return(action); }