Exemplo n.º 1
0
        // Utilities ---------------------------------

        /// <summary>
        /// Trains a POS tag maximum entropy model.
        /// </summary>
        /// <param name="eventStream">Stream of training events</param>
        /// <param name="iterations">number of training iterations to perform</param>
        /// <param name="cut">cutoff value to use for the data indexer</param>
        /// <returns>Trained GIS model</returns>
        public static SharpEntropy.GisModel Train(SharpEntropy.ITrainingEventReader eventStream, int iterations, int cut)
        {
            var trainer = new SharpEntropy.GisTrainer();

            trainer.TrainModel(iterations, new SharpEntropy.TwoPassDataIndexer(eventStream, cut));
            return(new SharpEntropy.GisModel(trainer));
        }
Exemplo n.º 2
0
 public static void Train(SharpEntropy.ITrainingEventReader eventReader, string outputFilename)
 {
     SharpEntropy.GisTrainer trainer = new SharpEntropy.GisTrainer(0.1);
     trainer.TrainModel(100, new SharpEntropy.TwoPassDataIndexer(eventReader, 5));
     SharpEntropy.GisModel tokenizeModel = new SharpEntropy.GisModel(trainer);
     new SharpEntropy.IO.BinaryGisModelWriter().Persist(tokenizeModel, outputFilename);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Trains the chunker.  Training file should be one word per line where each line consists of a
 /// space-delimited triple of "word pos outcome".  Sentence breaks are indicated by blank lines.
 /// </summary>
 /// <param name="eventReader">
 /// The chunker event reader.
 /// </param>
 /// <returns>
 /// Trained model.
 /// </returns>
 public static SharpEntropy.GisModel Train(SharpEntropy.ITrainingEventReader eventReader)
 {
     return(Train(eventReader, 100, 5));
 }
 private static SharpEntropy.GisModel Train(SharpEntropy.ITrainingEventReader eventReader, int iterations, int cutoff)
 {
     SharpEntropy.GisTrainer trainer = new SharpEntropy.GisTrainer();
     trainer.TrainModel(iterations, new SharpEntropy.TwoPassDataIndexer(eventReader, cutoff));
     return(new SharpEntropy.GisModel(trainer));
 }
Exemplo n.º 5
0
		public static SharpEntropy.GisModel TrainModel(SharpEntropy.ITrainingEventReader eventReader, int iterations, int cut)
		{
			SharpEntropy.GisTrainer trainer = new SharpEntropy.GisTrainer();
			trainer.TrainModel(eventReader, iterations, cut);
			return new SharpEntropy.GisModel(trainer);
		}