Search in sources :

Example 1 with ClassificationModelTrainer

use of com.joliciel.talismane.machineLearning.ClassificationModelTrainer in project talismane by joliciel-informatique.

the class SentenceDetectorTrainer method train.

public ClassificationModel train() throws TalismaneException, IOException {
    ModelTrainerFactory factory = new ModelTrainerFactory();
    ClassificationModelTrainer trainer = factory.constructTrainer(sentenceConfig.getConfig("train.machine-learning"));
    ClassificationModel model = trainer.trainModel(eventStream, descriptors);
    model.setExternalResources(TalismaneSession.get(sessionId).getExternalResourceFinder().getExternalResources());
    File modelDir = modelFile.getParentFile();
    if (modelDir != null)
        modelDir.mkdirs();
    model.persist(modelFile);
    return model;
}
Also used : ModelTrainerFactory(com.joliciel.talismane.machineLearning.ModelTrainerFactory) ClassificationModelTrainer(com.joliciel.talismane.machineLearning.ClassificationModelTrainer) File(java.io.File) ClassificationModel(com.joliciel.talismane.machineLearning.ClassificationModel)

Example 2 with ClassificationModelTrainer

use of com.joliciel.talismane.machineLearning.ClassificationModelTrainer in project talismane by joliciel-informatique.

the class PosTaggerTrainer method train.

public ClassificationModel train() throws TalismaneException, IOException {
    ModelTrainerFactory factory = new ModelTrainerFactory();
    ClassificationModelTrainer trainer = factory.constructTrainer(posTaggerConfig.getConfig("train.machine-learning"));
    ClassificationModel model = trainer.trainModel(eventStream, descriptors);
    model.setExternalResources(TalismaneSession.get(sessionId).getExternalResourceFinder().getExternalResources());
    File modelDir = modelFile.getParentFile();
    if (modelDir != null)
        modelDir.mkdirs();
    model.persist(modelFile);
    return model;
}
Also used : ModelTrainerFactory(com.joliciel.talismane.machineLearning.ModelTrainerFactory) ClassificationModelTrainer(com.joliciel.talismane.machineLearning.ClassificationModelTrainer) File(java.io.File) ClassificationModel(com.joliciel.talismane.machineLearning.ClassificationModel)

Example 3 with ClassificationModelTrainer

use of com.joliciel.talismane.machineLearning.ClassificationModelTrainer in project talismane by joliciel-informatique.

the class PatternTokeniserTrainer method train.

public ClassificationModel train() throws TalismaneException, IOException {
    ModelTrainerFactory factory = new ModelTrainerFactory();
    ClassificationModelTrainer trainer = factory.constructTrainer(tokeniserConfig.getConfig("train.machine-learning"));
    ClassificationModel model = trainer.trainModel(eventStream, descriptors);
    model.setExternalResources(TalismaneSession.get(sessionId).getExternalResourceFinder().getExternalResources());
    File modelDir = modelFile.getParentFile();
    if (modelDir != null)
        modelDir.mkdirs();
    model.persist(modelFile);
    return model;
}
Also used : ModelTrainerFactory(com.joliciel.talismane.machineLearning.ModelTrainerFactory) ClassificationModelTrainer(com.joliciel.talismane.machineLearning.ClassificationModelTrainer) File(java.io.File) ClassificationModel(com.joliciel.talismane.machineLearning.ClassificationModel)

Example 4 with ClassificationModelTrainer

use of com.joliciel.talismane.machineLearning.ClassificationModelTrainer in project talismane by joliciel-informatique.

the class ParserTrainer method train.

public ClassificationModel train() throws TalismaneException, IOException {
    ModelTrainerFactory factory = new ModelTrainerFactory();
    ClassificationModelTrainer trainer = factory.constructTrainer(parserConfig.getConfig("train.machine-learning"));
    ClassificationModel model = trainer.trainModel(eventStream, descriptors);
    model.setExternalResources(TalismaneSession.get(sessionId).getExternalResourceFinder().getExternalResources());
    File modelDir = modelFile.getParentFile();
    if (modelDir != null)
        modelDir.mkdirs();
    model.persist(modelFile);
    return model;
}
Also used : ModelTrainerFactory(com.joliciel.talismane.machineLearning.ModelTrainerFactory) ClassificationModelTrainer(com.joliciel.talismane.machineLearning.ClassificationModelTrainer) File(java.io.File) ClassificationModel(com.joliciel.talismane.machineLearning.ClassificationModel)

Example 5 with ClassificationModelTrainer

use of com.joliciel.talismane.machineLearning.ClassificationModelTrainer in project talismane by joliciel-informatique.

the class LanguageDetectorTrainer method train.

public ClassificationModel train() throws TalismaneException, IOException {
    ModelTrainerFactory factory = new ModelTrainerFactory();
    ClassificationModelTrainer trainer = factory.constructTrainer(languageConfig.getConfig("train.machine-learning"));
    ClassificationModel model = trainer.trainModel(eventStream, descriptors);
    model.setExternalResources(session.getExternalResourceFinder().getExternalResources());
    File modelDir = modelFile.getParentFile();
    if (modelDir != null)
        modelDir.mkdirs();
    model.persist(modelFile);
    return model;
}
Also used : ModelTrainerFactory(com.joliciel.talismane.machineLearning.ModelTrainerFactory) ClassificationModelTrainer(com.joliciel.talismane.machineLearning.ClassificationModelTrainer) File(java.io.File) ClassificationModel(com.joliciel.talismane.machineLearning.ClassificationModel)

Aggregations

ClassificationModel (com.joliciel.talismane.machineLearning.ClassificationModel)8 ClassificationModelTrainer (com.joliciel.talismane.machineLearning.ClassificationModelTrainer)8 ModelTrainerFactory (com.joliciel.talismane.machineLearning.ModelTrainerFactory)8 File (java.io.File)8 JochreException (com.joliciel.jochre.utils.JochreException)3 ClassificationEventStream (com.joliciel.talismane.machineLearning.ClassificationEventStream)3 BoundaryDetector (com.joliciel.jochre.boundaries.BoundaryDetector)1 DeterministicBoundaryDetector (com.joliciel.jochre.boundaries.DeterministicBoundaryDetector)1 JochreMergeEventStream (com.joliciel.jochre.boundaries.JochreMergeEventStream)1 JochreSplitEventStream (com.joliciel.jochre.boundaries.JochreSplitEventStream)1 LetterByLetterBoundaryDetector (com.joliciel.jochre.boundaries.LetterByLetterBoundaryDetector)1 OriginalBoundaryDetector (com.joliciel.jochre.boundaries.OriginalBoundaryDetector)1 RecursiveShapeSplitter (com.joliciel.jochre.boundaries.RecursiveShapeSplitter)1 ShapeMerger (com.joliciel.jochre.boundaries.ShapeMerger)1 ShapeSplitter (com.joliciel.jochre.boundaries.ShapeSplitter)1 TrainingCorpusShapeMerger (com.joliciel.jochre.boundaries.TrainingCorpusShapeMerger)1 TrainingCorpusShapeSplitter (com.joliciel.jochre.boundaries.TrainingCorpusShapeSplitter)1 MergeFeature (com.joliciel.jochre.boundaries.features.MergeFeature)1 MergeFeatureParser (com.joliciel.jochre.boundaries.features.MergeFeatureParser)1 SplitFeature (com.joliciel.jochre.boundaries.features.SplitFeature)1