Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public java.util.List<String[]> parseSentences(java.util.List<String[]> inputSentences, String defaultRootLabel, int markingStrategy, boolean coveredRoot, org.maltparser.core.symbol.SymbolTableHandler parentSymbolTableHandler, org.maltparser.concurrent.graph.dataformat.DataFormat concurrentDataFormat) throws org.maltparser.core.exception.MaltChainedException
        public IList <string[]> parseSentences(IList <string[]> inputSentences, string defaultRootLabel, int markingStrategy, bool coveredRoot, SymbolTableHandler parentSymbolTableHandler, DataFormat concurrentDataFormat)
        {
            IList <string[]>      outputSentences         = Collections.synchronizedList(new List <string[]>());
            SymbolTableHandler    parseSymbolTableHandler = new ParseSymbolTableHandler(parentSymbolTableHandler);
            LWDependencyGraph     parseGraph = new LWDependencyGraph(concurrentDataFormat, parseSymbolTableHandler);
            LWDeterministicParser parser     = new LWDeterministicParser(this, parseSymbolTableHandler);

            for (int i = 0; i < inputSentences.Count; i++)
            {
                string[] tokens = inputSentences[i];
                // TODO nothing to parse
                parseGraph.resetTokens(tokens, defaultRootLabel, false);
                parser.parse(parseGraph);
                if (markingStrategy != 0 || coveredRoot)
                {
                    (new LWDeprojectivizer()).deprojectivize(parseGraph, markingStrategy);
                }
                string[] outputTokens = new string[tokens.Length];
                for (int j = 0; j < outputTokens.Length; j++)
                {
                    outputTokens[j] = parseGraph.GetDependencyNode(j + 1).ToString();
                }
                outputSentences.Add(outputTokens);
            }
            return(outputSentences);
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void parse(org.maltparser.core.syntaxgraph.DependencyStructure graph) throws org.maltparser.core.exception.MaltChainedException
        public void Parse(IDependencyStructure graph)
        {
            if (graph.HasTokens())
            {
                LWDeterministicParser parser = new LWDeterministicParser(this, graph.SymbolTables);
                parser.parse(graph);
            }
        }