code: public final POSModel train(final TrainingParameters params) {
      // features
      if (getPosTaggerFactory() == null) {
        throw new IllegalStateException(
            "Classes derived from AbstractTrainer must "
                + " create a POSTaggerFactory features!");
      }
      // training model
      POSModel trainedModel = null;
      POSEvaluator posEvaluator = null;
      try {
        trainedModel = POSTaggerME.train(this.lang, this.trainSamples, params,
            getPosTaggerFactory());
        final POSTaggerME posTagger = new POSTaggerME(trainedModel);
        posEvaluator = new POSEvaluator(posTagger);
        posEvaluator.evaluate(this.testSamples);
      } catch (final IOException e) {
        System.err.println("IO error while loading training and test sets!");
        e.printStackTrace();
        System.exit(1);
      }
      System.out.println("Final result: " + posEvaluator.getWordAccuracy());
      return trainedModel;
    }
docs: /*
  (non-Javadoc)
  
  @see es.ehu.si.ixa.pipe.pos.train.Trainer#train(opennlp.tools.util.
  TrainingParameters)