Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void saveFeatureMap(java.io.OutputStream os, org.maltparser.ml.lib.FeatureMap map) throws org.maltparser.core.exception.MaltChainedException
        protected internal virtual void saveFeatureMap(Stream os, FeatureMap map)
        {
            try
            {
                ObjectOutputStream output = new ObjectOutputStream(os);
                try
                {
                    output.writeObject(map);
                }
                finally
                {
                    output.close();
                }
            }
            catch (IOException e)
            {
                throw new LibException("Save feature map error", e);
            }
        }
Пример #2
0
        /// <summary>
        /// Constructs a Lib learner.
        /// </summary>
        /// <param name="owner"> the guide model owner </param>
        /// <param name="learnerMode"> the mode of the learner BATCH or CLASSIFY </param>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public Lib(org.maltparser.parser.guide.instance.InstanceModel owner, System.Nullable<int> learnerMode, String learningMethodName) throws org.maltparser.core.exception.MaltChainedException
        public Lib(InstanceModel owner, int?learnerMode, string learningMethodName)
        {
            this.owner       = owner;
            this.learnerMode = learnerMode.Value;
            name             = learningMethodName;
            if (Configuration.getOptionValue("lib", "verbosity") != null)
            {
                verbosity = Enum.Parse(typeof(Verbostity), Configuration.getOptionValue("lib", "verbosity").ToString().ToUpper());
            }
            else
            {
                verbosity = Verbostity.SILENT;
            }
            NumberOfInstances = 0;
            if (Configuration.getOptionValue("singlemalt", "null_value") != null && Configuration.getOptionValue("singlemalt", "null_value").ToString().Equals("none", StringComparison.OrdinalIgnoreCase))
            {
                excludeNullValues = true;
            }
            else
            {
                excludeNullValues = false;
            }

            if (learnerMode.Value == LearningMethod_Fields.BATCH)
            {
                featureMap     = new FeatureMap();
                instanceOutput = new StreamWriter(getInstanceOutputStreamWriter(".ins"));
            }
            else if (learnerMode.Value == LearningMethod_Fields.CLASSIFY)
            {
                featureMap = (FeatureMap)getConfigFileEntryObject(".map");
            }
            else
            {
                featureMap = null;
            }
        }