コード例 #1
0
        /// <summary>
        /// Terminates the parser model.
        /// </summary>
        /// <exception cref="MaltChainedException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void terminateParserModel() throws org.maltparser.core.exception.MaltChainedException
        public virtual void terminateParserModel()
        {
            if (!initialized)
            {
                throw new MaltChainedException("No parser model has been initialized. Please use the method initializeParserModel() before invoking this method.");
            }
            // Runs the postprocess chart items of the "parse" flow chart
            if (flowChartInstance.hasPostProcessChartItems())
            {
                flowChartInstance.postprocess();
            }

            // Terminate the flow chart with an option container
            engine.terminate(optionContainer);
        }
コード例 #2
0
ファイル: Engine.cs プロジェクト: Sojaner/NMaltParser
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void process(int optionContainerIndex) throws org.maltparser.core.exception.MaltChainedException
        public virtual void process(int optionContainerIndex)
        {
            FlowChartInstance flowChartInstance = flowChartInstances[optionContainerIndex];

            if (flowChartInstance.hasPreProcessChartItems())
            {
                flowChartInstance.preprocess();
            }
            if (flowChartInstance.hasProcessChartItems())
            {
                int signal          = ChartItem.CONTINUE;
                int tic             = 0;
                int sentenceCounter = 0;
                int nIteration      = 1;
                flowChartInstance.setEngineRegistry("iterations", nIteration);
                System.GC.Collect();
                while (signal != ChartItem.TERMINATE)
                {
                    signal = flowChartInstance.process();
                    if (signal == ChartItem.CONTINUE)
                    {
                        sentenceCounter++;
                    }
                    else if (signal == ChartItem.NEWITERATION)
                    {
                        SystemLogger.logger().info("\n=== END ITERATION " + nIteration + " ===\n");
                        nIteration++;
                        flowChartInstance.setEngineRegistry("iterations", nIteration);
                    }
                    if (sentenceCounter < 101 && sentenceCounter == 1 || sentenceCounter == 10 || sentenceCounter == 100)
                    {
                        Util.startTicer(SystemLogger.logger(), startTime, 10, sentenceCounter);
                    }
                    if (sentenceCounter % 100 == 0)
                    {
                        tic = Util.simpleTicer(SystemLogger.logger(), startTime, 10, tic, sentenceCounter);
                    }
                }
                Util.endTicer(SystemLogger.logger(), startTime, 10, tic, sentenceCounter);
            }
            if (flowChartInstance.hasPostProcessChartItems())
            {
                flowChartInstance.postprocess();
            }
        }