Пример #1
0
        //	private PropagationManager loadPropagationManager(int optionContainer, McoModel mcoModel) throws MaltChainedException {
        //		String propagationSpecFileName = OptionManager.instance().getOptionValue(optionContainer, "singlemalt", "propagation").toString();
        //		PropagationManager propagationManager = null;
        //		if (propagationSpecFileName != null && propagationSpecFileName.length() > 0) {
        //			propagationManager = new PropagationManager();
        //			try {
        //				propagationManager.loadSpecification(mcoModel.getMcoEntryURL(propagationSpecFileName));
        //			} catch(IOException e) {
        //				throw new MaltChainedException("Couldn't read file "+propagationSpecFileName+" from mco-file ", e);
        //			}
        //		}
        //		return propagationManager;
        //	}

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private org.maltparser.core.feature.FeatureModelManager loadFeatureModelManager(int optionContainer, org.maltparser.core.lw.parser.McoModel mcoModel) throws org.maltparser.core.exception.MaltChainedException
        private FeatureModelManager loadFeatureModelManager(int optionContainer, McoModel mcoModel)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.maltparser.core.feature.system.FeatureEngine system = new org.maltparser.core.feature.system.FeatureEngine();
            FeatureEngine system = new FeatureEngine();

            system.load("/appdata/features/ParserFeatureSystem.xml");
            system.load(PluginLoader.instance());
            FeatureModelManager featureModelManager = new FeatureModelManager(system);
            string featureModelFileName             = OptionManager.instance().getOptionValue(optionContainer, "guide", "features").ToString().Trim();

            try
            {
                if (featureModelFileName.EndsWith(".par", StringComparison.Ordinal))
                {
                    string markingStrategy = OptionManager.instance().getOptionValue(optionContainer, "pproj", "marking_strategy").ToString().Trim();
                    string coveredRoot     = OptionManager.instance().getOptionValue(optionContainer, "pproj", "covered_root").ToString().Trim();
                    featureModelManager.loadParSpecification(mcoModel.GetMcoEntryUrl(featureModelFileName), markingStrategy, coveredRoot);
                }
                else
                {
                    featureModelManager.loadSpecification(mcoModel.GetMcoEntryUrl(featureModelFileName));
                }
            }
            catch (IOException e)
            {
                throw new MaltChainedException("Couldn't read file " + featureModelFileName + " from mco-file ", e);
            }
            return(featureModelManager);
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void initFeatureSystem() throws org.maltparser.core.exception.MaltChainedException
        protected internal virtual void initFeatureSystem()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.maltparser.core.feature.system.FeatureEngine system = new org.maltparser.core.feature.system.FeatureEngine();
            FeatureEngine system = new FeatureEngine();

            system.load("/appdata/features/ParserFeatureSystem.xml");
            system.load(PluginLoader.instance());
            featureModelManager = new FeatureModelManager(system);
            string featureModelFileName = getOptionValue("guide", "features").ToString().Trim();

            if (featureModelFileName.EndsWith(".par", StringComparison.Ordinal))
            {
                string markingStrategy = getOptionValue("pproj", "marking_strategy").ToString().Trim();
                string coveredRoot     = getOptionValue("pproj", "covered_root").ToString().Trim();
                featureModelManager.loadParSpecification(findURL(featureModelFileName), markingStrategy, coveredRoot);
            }
            else
            {
                featureModelManager.loadSpecification(findURL(featureModelFileName));
            }
        }