private void TrainWordAlignmentModel(string swmPrefix, Func <string, string> sourcePreprocessor, Func <string, string> targetPreprocessor, ParallelTextCorpus corpus, IProgress <ProgressStatus> progress) { using (var model = new ThotWordAlignmentModel(swmPrefix, true)) { foreach (ParallelTextSegment segment in GetTrainingSegments(corpus)) { model.AddSegmentPair(segment, sourcePreprocessor, targetPreprocessor); } model.Train(progress); model.Save(); } }
private void TrainWordAlignmentModel(string swmPrefix, Func <string, string> sourcePreprocessor, Func <string, string> targetPreprocessor, ParallelTextCorpus corpus, string name, ThotTrainProgressReporter reporter) { using (var model = new ThotWordAlignmentModel(swmPrefix, true)) { foreach (ParallelTextSegment segment in GetTrainingSegments(corpus)) { model.AddSegmentPair(segment, sourcePreprocessor, targetPreprocessor); } for (int i = 0; i < 5; i++) { reporter.Step($"Training {name} alignment model"); model.TrainingIteration(); } model.Save(); } }