code: protected void train() throws Exception {
        final SequenceFeaturizer<Annotation> featurizer = getFeaturizer();
        Dataset<Sequence> train = getDataset(featurizer);
        PreprocessorList<Sequence> preprocessors = getPreprocessors();
        if (preprocessors != null && preprocessors.size() > 0) {
           train = train.preprocess(preprocessors);
        }
        train.encode();
        SequenceLabelerLearner learner = getLearner();
        learner.setValidator(getValidator());
        SequenceLabeler labeler = learner.train(train);
        BIOTagger tagger = new BIOTagger(featurizer, annotationType, labeler);
        tagger.write(model);
     }
docs: Train.
  
  @throws Exception the exception