//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void initialize(org.maltparser.core.flow.FlowChartInstance flowChartinstance, org.maltparser.core.flow.spec.ChartItemSpecification chartItemSpecification) throws org.maltparser.core.exception.MaltChainedException
        public override void initialize(FlowChartInstance flowChartinstance, ChartItemSpecification chartItemSpecification)
        {
            base.initialize(flowChartinstance, chartItemSpecification);
            foreach (string key in chartItemSpecification.ChartItemAttributes.Keys)
            {
                if (key.Equals("id"))
                {
                    idName = chartItemSpecification.ChartItemAttributes[key];
                }
                else if (key.Equals("source"))
                {
                    sourceName = chartItemSpecification.ChartItemAttributes[key];
                }
            }
            if (ReferenceEquals(idName, null))
            {
                idName = getChartElement("analyzer").Attributes.get("id").DefaultValue;
            }
            else if (ReferenceEquals(sourceName, null))
            {
                sourceName = getChartElement("analyzer").Attributes.get("source").DefaultValue;
            }
            task      = OptionManager.instance().getOptionValue(OptionContainerIndex, "analyzer", "task").ToString();
            configDir = (ConfigurationDir)flowChartinstance.getFlowChartRegistry(typeof(ConfigurationDir), idName);
            open(task + ".dat", OptionManager.instance().getOptionValue(OptionContainerIndex, "input", "charset").ToString());
        }
示例#2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void initialize(org.maltparser.core.flow.FlowChartInstance flowChartinstance, org.maltparser.core.flow.spec.ChartItemSpecification chartItemSpecification) throws org.maltparser.core.exception.MaltChainedException
        public override void initialize(FlowChartInstance flowChartinstance, ChartItemSpecification chartItemSpecification)
        {
            base.initialize(flowChartinstance, chartItemSpecification);

            foreach (string key in chartItemSpecification.ChartItemAttributes.Keys)
            {
                if (key.Equals("target"))
                {
                    targetName = chartItemSpecification.ChartItemAttributes[key];
                }
                else if (key.Equals("source"))
                {
                    sourceName = chartItemSpecification.ChartItemAttributes[key];
                }
                else if (key.Equals("mode"))
                {
                    modeName = chartItemSpecification.ChartItemAttributes[key];
                }
                else if (key.Equals("task"))
                {
                    taskName = chartItemSpecification.ChartItemAttributes[key];
                }
                else if (key.Equals("id"))
                {
                    idName = chartItemSpecification.ChartItemAttributes[key];
                }
            }
            if (ReferenceEquals(targetName, null))
            {
                targetName = getChartElement("singlemalt").Attributes.get("target").DefaultValue;
            }
            else if (ReferenceEquals(sourceName, null))
            {
                sourceName = getChartElement("singlemalt").Attributes.get("source").DefaultValue;
            }
            else if (ReferenceEquals(modeName, null))
            {
                modeName = getChartElement("singlemalt").Attributes.get("mode").DefaultValue;
            }
            else if (ReferenceEquals(taskName, null))
            {
                taskName = getChartElement("singlemalt").Attributes.get("task").DefaultValue;
            }
            else if (ReferenceEquals(idName, null))
            {
                idName = getChartElement("singlemalt").Attributes.get("id").DefaultValue;
            }

            singleMalt = (SingleMalt)flowChartinstance.getFlowChartRegistry(typeof(SingleMalt), idName);
            if (singleMalt == null)
            {
                singleMalt = new SingleMalt();
                flowChartinstance.addFlowChartRegistry(typeof(SingleMalt), idName, singleMalt);
                flowChartinstance.addFlowChartRegistry(typeof(Configuration), idName, singleMalt);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void initialize(org.maltparser.core.flow.FlowChartInstance flowChartinstance, org.maltparser.core.flow.spec.ChartItemSpecification chartItemSpecification) throws org.maltparser.core.exception.MaltChainedException
        public override void initialize(FlowChartInstance flowChartinstance, ChartItemSpecification chartItemSpecification)
        {
            base.initialize(flowChartinstance, chartItemSpecification);

            foreach (string key in chartItemSpecification.ChartItemAttributes.Keys)
            {
                if (key.Equals("target"))
                {
                    targetName = chartItemSpecification.ChartItemAttributes[key];
                }
                else if (key.Equals("source"))
                {
                    sourceName = chartItemSpecification.ChartItemAttributes[key];
                }
                else if (key.Equals("id"))
                {
                    idName = chartItemSpecification.ChartItemAttributes[key];
                }
                else if (key.Equals("task"))
                {
                    taskName = chartItemSpecification.ChartItemAttributes[key];
                }
            }

            if (ReferenceEquals(targetName, null))
            {
                targetName = getChartElement("pseudoproj").Attributes.get("target").DefaultValue;
            }
            else if (ReferenceEquals(sourceName, null))
            {
                sourceName = getChartElement("pseudoproj").Attributes.get("source").DefaultValue;
            }
            else if (ReferenceEquals(idName, null))
            {
                idName = getChartElement("pseudoproj").Attributes.get("id").DefaultValue;
            }
            else if (ReferenceEquals(taskName, null))
            {
                taskName = getChartElement("pseudoproj").Attributes.get("task").DefaultValue;
            }

            PseudoProjectivity tmppproj = (PseudoProjectivity)flowChartinstance.getFlowChartRegistry(typeof(PseudoProjectivity), idName);

            if (tmppproj == null)
            {
                pproj = new PseudoProjectivity();
                flowChartinstance.addFlowChartRegistry(typeof(PseudoProjectivity), idName, pproj);
            }
            else
            {
                pproj = tmppproj;
            }
        }
示例#4
0
        /// <summary>
        /// Initialize a parser model that later can by used to parse sentences. MaltParser is controlled by a commandLine string, please see the documentation of MaltParser to see all available options.
        /// </summary>
        /// <param name="commandLine"> a commandLine string that controls the MaltParser </param>
        /// <exception cref="MaltChainedException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void initializeParserModel(String commandLine) throws org.maltparser.core.exception.MaltChainedException
        public virtual void initializeParserModel(string commandLine)
        {
            if (optionContainer == -1)
            {
                throw new MaltChainedException("MaltParserService has been initialized as an option free initialization and therefore no parser model can be initialized.");
            }
            OptionManager.instance().parseCommandLine(commandLine, optionContainer);
            // Creates an engine
            engine = new Engine();
            // Initialize the engine with option container and gets a flow chart instance
            flowChartInstance = engine.initialize(optionContainer);
            // Runs the preprocess chart items of the "parse" flow chart
            if (flowChartInstance.hasPreProcessChartItems())
            {
                flowChartInstance.preprocess();
            }
            singleMalt = (SingleMalt)flowChartInstance.getFlowChartRegistry(typeof(SingleMalt), "singlemalt");
            singleMalt.ConfigurationDir.initDataFormat();
            dataFormatInstance = singleMalt.ConfigurationDir.DataFormatManager.InputDataFormatSpec.createDataFormatInstance(singleMalt.SymbolTables, OptionManager.instance().getOptionValueString(optionContainer, "singlemalt", "null_value"));
            initialized        = true;
        }