Example #1
0
        static void TrainAndWrite(string propPath, string modelPath)
        {
            Properties props = StringUtils.propFileToProperties(propPath);

            var flags = new SeqClassifierFlags(props);

            var crf = new CRFClassifier(flags);

            crf.train();
            crf.serializeClassifier(modelPath);
        }
Example #2
0
        public void createModelFromTrainingData(string inputPath, string outputPath, string properties)
        {
            Properties props = edu.stanford.nlp.util.StringUtils.propFileToProperties(properties);

            props.setProperty("serializeTo", outputPath);

            if (inputPath != null)
            {
                props.setProperty("trainFile", inputPath);
            }

            SeqClassifierFlags flags = new SeqClassifierFlags(props);
            CRFClassifier      crf   = new CRFClassifier(flags);

            crf.train();
            crf.serializeClassifier(outputPath);
        }