コード例 #1
0
//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)
        {
            PlanarConfig planarConfig = (PlanarConfig)config;

            if (planarConfig.getRootHandling() != PlanarConfig.NORMAL && planarConfig.Stack.Peek().Root)
            {
                return(updateActionContainers(history, SHIFT, null));
            }
            return(null);
        }
コード例 #2
0
//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)
        {
            PlanarConfig         planarConfig = (PlanarConfig)config;
            IDependencyStructure dg           = planarConfig.DependencyGraph;
            DependencyNode       stackPeek    = planarConfig.Stack.Peek();
            int stackPeekIndex = stackPeek.Index;
            int inputPeekIndex = planarConfig.Input.Peek().Index;

            if (!stackPeek.Root && gold.GetTokenNode(stackPeekIndex).Head.Index == inputPeekIndex && !checkIfArcExists(dg, inputPeekIndex, stackPeekIndex))
            {
                return(updateActionContainers(Planar.LEFTARC, gold.GetTokenNode(stackPeekIndex).HeadEdge.LabelSet));
            }
            else if (gold.GetTokenNode(inputPeekIndex).Head.Index == stackPeekIndex && !checkIfArcExists(dg, stackPeekIndex, inputPeekIndex))
            {
                return(updateActionContainers(Planar.RIGHTARC, gold.GetTokenNode(inputPeekIndex).HeadEdge.LabelSet));
            }
            else if (gold.GetTokenNode(inputPeekIndex).hasLeftDependent() && gold.GetTokenNode(inputPeekIndex).LeftmostDependent.Index < stackPeekIndex)
            {
                return(updateActionContainers(Planar.REDUCE, null));
            }
            else if (gold.GetTokenNode(inputPeekIndex).Head.Index < stackPeekIndex && (!gold.GetTokenNode(inputPeekIndex).Head.Root || planarConfig.getRootHandling() == PlanarConfig.NORMAL))
            {
                return(updateActionContainers(Planar.REDUCE, null));
            }
            else
            {
                return(updateActionContainers(Planar.SHIFT, null));
            }
        }