Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void linkAllTreesToRoot() throws org.maltparser.core.exception.MaltChainedException
        public void LinkAllTreesToRoot()
        {
            for (int i = 0; i < nodes.Count; i++)
            {
                if (!nodes[i].hasHead())
                {
                    LWNode head      = nodes[0];
                    LWNode dependent = nodes[i];
                    Edge   headEdge  = new LWEdge(head, dependent);
                    headEdge.addLabel(DefaultRootEdgeLabels);
                    dependent.addIncomingEdge(headEdge);
                }
            }
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void removeDependencyEdge(int headIndex, int dependentIndex) throws org.maltparser.core.exception.MaltChainedException
        public void RemoveDependencyEdge(int headIndex, int dependentIndex)
        {
            if (headIndex < 0 && headIndex >= nodes.Count)
            {
                throw new LWGraphException("The head doesn't exists");
            }
            if (dependentIndex < 0 && dependentIndex >= nodes.Count)
            {
                throw new LWGraphException("The dependent doesn't exists");
            }
            LWNode head      = nodes[headIndex];
            LWNode dependent = nodes[dependentIndex];
            Edge   headEdge  = new LWEdge(head, dependent);

            dependent.removeIncomingEdge(headEdge);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public org.maltparser.core.syntaxgraph.edge.Edge moveDependencyEdge(int newHeadIndex, int dependentIndex) throws org.maltparser.core.exception.MaltChainedException
        public Edge MoveDependencyEdge(int newHeadIndex, int dependentIndex)
        {
            if (newHeadIndex < 0 && newHeadIndex >= nodes.Count)
            {
                throw new LWGraphException("The head doesn't exists");
            }
            if (dependentIndex < 0 && dependentIndex >= nodes.Count)
            {
                throw new LWGraphException("The dependent doesn't exists");
            }

            LWNode head        = nodes[newHeadIndex];
            LWNode dependent   = nodes[dependentIndex];
            Edge   oldheadEdge = dependent.HeadEdge;
            Edge   headEdge    = new LWEdge(head, dependent);

            headEdge.addLabel(oldheadEdge.LabelSet);
            dependent.addIncomingEdge(headEdge);
            return(headEdge);
        }