Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static org.maltparser.core.syntaxgraph.DependencyStructure getOldDependencyGraph(org.maltparser.concurrent.graph.dataformat.DataFormat dataFormat, org.maltparser.core.symbol.SymbolTableHandler symbolTableHandlers, String[] tokens) throws org.maltparser.core.exception.MaltChainedException
        public static IDependencyStructure getOldDependencyGraph(DataFormat dataFormat, SymbolTableHandler symbolTableHandlers, string[] tokens)
        {
            IDependencyStructure oldGraph = new DependencyGraph(symbolTableHandlers);

            for (int i = 0; i < tokens.Length; i++)
            {
                oldGraph.AddDependencyNode(i + 1);
            }
            for (int i = 0; i < tokens.Length; i++)
            {
                DependencyNode node  = oldGraph.GetDependencyNode(i + 1);
                string[]       items = tokens[i].Split("\t", true);
                Edge           edge  = null;
                for (int j = 0; j < items.Length; j++)
                {
                    ColumnDescription column = dataFormat.GetColumnDescription(j);

                    if (column.Category == ColumnDescription.Input && node != null)
                    {
                        oldGraph.AddLabel(node, column.Name, items[j]);
                    }
                    else if (column.Category == ColumnDescription.Head)
                    {
                        if (column.Category != ColumnDescription.Ignore && !items[j].Equals(IGNORE_COLUMN_SIGN))
                        {
                            edge = oldGraph.AddDependencyEdge(int.Parse(items[j]), i + 1);
                        }
                    }
                    else if (column.Category == ColumnDescription.DependencyEdgeLabel && edge != null)
                    {
                        oldGraph.AddLabel(edge, column.Name, items[j]);
                    }
                }
            }

            oldGraph.SetDefaultRootEdgeLabel(oldGraph.SymbolTables.getSymbolTable("DEPREL"), "ROOT");
            return(oldGraph);
        }