//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void removeLabel(org.maltparser.core.symbol.SymbolTable table) throws org.maltparser.core.exception.MaltChainedException public void removeLabel(SymbolTable table) { LWDependencyGraph graph = (LWDependencyGraph)BelongsToGraph; ColumnDescription column = graph.DataFormat.GetColumnDescription(table.Name); labels.Remove(column); }
/// <summary> /// Returns the label code (an integer representation) of the symbol table if it exists, otherwise /// an exception is thrown. /// </summary> /// <param name="table"> the symbol table </param> /// <returns> the label code (an integer representation) of the symbol table if it exists </returns> /// <exception cref="MaltChainedException"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public int getLabelCode(org.maltparser.core.symbol.SymbolTable table) throws org.maltparser.core.exception.MaltChainedException public int getLabelCode(SymbolTable table) { LWDependencyGraph graph = (LWDependencyGraph)BelongsToGraph; ColumnDescription column = graph.DataFormat.GetColumnDescription(table.Name); return(table.getSymbolStringToCode(labels[column])); }
/// <summary> /// Returns the label symbol(a string representation) of the symbol table if it exists, otherwise /// an exception is thrown. /// </summary> /// <param name="table"> the symbol table </param> /// <returns> the label (a string representation) of the symbol table if it exists. </returns> /// <exception cref="MaltChainedException"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public String getLabelSymbol(org.maltparser.core.symbol.SymbolTable table) throws org.maltparser.core.exception.MaltChainedException public string getLabelSymbol(SymbolTable table) { LWDependencyGraph graph = (LWDependencyGraph)BelongsToGraph; ColumnDescription column = graph.DataFormat.GetColumnDescription(table.Name); return(labels[column]); }
/// <summary> /// Adds a label (a string value) to the symbol table and to the graph element. /// </summary> /// <param name="table"> the symbol table </param> /// <param name="symbol"> a label symbol </param> /// <exception cref="MaltChainedException"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void addLabel(org.maltparser.core.symbol.SymbolTable table, String symbol) throws org.maltparser.core.exception.MaltChainedException public void addLabel(SymbolTable table, string symbol) { LWDependencyGraph graph = (LWDependencyGraph)BelongsToGraph; ColumnDescription column = graph.DataFormat.GetColumnDescription(table.Name); table.addSymbol(symbol); labels[column] = symbol; }
/// <summary> /// Returns <i>true</i> if the graph element has a label for the symbol table, otherwise <i>false</i>. /// </summary> /// <param name="table"> the symbol table </param> /// <returns> <i>true</i> if the graph element has a label for the symbol table, otherwise <i>false</i>. </returns> /// <exception cref="MaltChainedException"> </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean hasLabel(org.maltparser.core.symbol.SymbolTable table) throws org.maltparser.core.exception.MaltChainedException public bool hasLabel(SymbolTable table) { if (table == null) { return(false); } LWDependencyGraph graph = (LWDependencyGraph)BelongsToGraph; ColumnDescription column = graph.DataFormat.GetColumnDescription(table.Name); return(labels.ContainsKey(column)); }
public static void Main(string[] args) { long startTime = DateTimeHelper.CurrentUnixTimeMillis(); string inFile = args[0]; string charSet = "UTF-8"; StreamReader reader = null; try { DataFormat dataFormat = DataFormat.ParseDataFormatXmLFile("/appdata/dataformat/conllx.xml"); reader = new StreamReader(new FileStream(inFile, FileMode.Open, FileAccess.Read), charSet); int sentenceCounter = 0; while (true) { string[] goldTokens = readSentences(reader); if (goldTokens.Length == 0) { break; } sentenceCounter++; SymbolTableHandler newTable = new HashSymbolTableHandler(); IDependencyStructure newGraph = new LWDependencyGraph(dataFormat, newTable, goldTokens, "ROOT"); // SymbolTableHandler oldTable = new HashSymbolTableHandler(); // DependencyStructure oldGraph = getOldDependencyGraph(dataFormat, oldTable, goldTokens); int newGraphINT; int oldGraphINT; bool newGraphBOOL; bool oldGraphBOOL; SortedSet <LWNode> newGraphSortedSet; SortedSet <DependencyNode> oldGraphSortedSet; // for (int i = 0; i < newGraph.nDependencyNode(); i++) { // newGraphINT = newGraph.getDependencyNode(i).getIndex(); // oldGraphINT = oldGraph.getDependencyNode(i).getIndex(); // newGraphINT = newGraph.getNode(i).getHeadIndex(); // newGraphINT = newGraph.getDependencyNode(i).getHead() != null ? newGraph.getDependencyNode(i).getHead().getIndex() : -1; // oldGraphINT = oldGraph.getDependencyNode(i).getHead() != null ? oldGraph.getDependencyNode(i).getHead().getIndex() : -1; // newGraphINT = newGraph.getDependencyNode(i).getPredecessor() != null ? newGraph.getDependencyNode(i).getPredecessor().getIndex() : -1; // oldGraphINT = oldGraph.getDependencyNode(i).getPredecessor() != null ? oldGraph.getDependencyNode(i).getPredecessor().getIndex() : -1; // newGraphINT = newGraph.getTokenNode(i).getSuccessor() != null ? newGraph.getTokenNode(i).getSuccessor().getIndex() : -1; // oldGraphINT = oldGraph.getTokenNode(i).getSuccessor() != null ? oldGraph.getTokenNode(i).getSuccessor().getIndex() : -1; // newGraphINT = newGraph.getDependencyNode(i).getLeftDependentCount(); // oldGraphINT = oldGraph.getDependencyNode(i).getLeftDependentCount(); // // newGraphINT = newGraph.getDependencyNode(i).getRightDependentCount(); // oldGraphINT = oldGraph.getDependencyNode(i).getRightDependentCount(); // newGraphINT = newGraph.getDependencyNode(i).getRightmostDependent() != null ? newGraph.getNode(i).getRightmostDependent().getIndex() : -1; // oldGraphINT = oldGraph.getDependencyNode(i).getRightmostDependent() != null ? oldGraph.getDependencyNode(i).getRightmostDependent ().getIndex() : -1; // newGraphINT = newGraph.getDependencyNode(i).findComponent().getIndex(); // oldGraphINT = oldGraph.getDependencyNode(i).findComponent().getIndex(); // // newGraphINT = newGraph.getDependencyNode(i).getRank(); // oldGraphINT = oldGraph.getDependencyNode(i).getRank(); // newGraphBOOL = newGraph.getDependencyNode(i).isRoot(); // oldGraphBOOL = oldGraph.getDependencyNode(i).isRoot(); // newGraphBOOL = newGraph.getDependencyNode(i).hasRightDependent(); // oldGraphBOOL = oldGraph.getDependencyNode(i).hasRightDependent(); // newGraphBOOL = newGraph.getDependencyNode(i).hasHead(); // oldGraphBOOL = oldGraph.getDependencyNode(i).hasHead(); // if (newGraphBOOL != oldGraphBOOL) { // System.out.println(newGraphBOOL + "\t" + oldGraphBOOL); // } // newGraphSortedSet = newGraph.getNode(i).getRightDependents(); // oldGraphSortedSet = oldGraph.getDependencyNode(i).getLeftDependents(); // if (newGraphSortedSet.size() != oldGraphSortedSet.size()) { // System.out.println(newGraphSortedSet + "\t" + oldGraphSortedSet); // } else { // Iterator<DependencyNode> it = oldGraphSortedSet.iterator(); // for (Node n : newGraphSortedSet) { // DependencyNode o = it.next(); // if (n.getIndex() != o.getIndex()) { // System.out.println(n.getIndex() + "\t" + o.getIndex()); // } // } // } // if (newGraphINT != oldGraphINT) { // System.out.println(newGraphINT + "\t" + oldGraphINT); // } // } // System.out.println(oldGraph); } } catch (IOException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } catch (LWGraphException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } catch (MaltChainedException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } finally { if (reader != null) { try { reader.Close(); } catch (IOException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } } } long elapsed = DateTimeHelper.CurrentUnixTimeMillis() - startTime; Console.WriteLine("Finished init basic : " + (new Formatter()).format("%02d:%02d:%02d", elapsed / 3600000, elapsed % 3600000 / 60000, elapsed % 60000 / 1000) + " (" + elapsed + " ms)"); }