code: public static void main(String[] argvs) {
          List<String[]> sentences = new ArrayList<>();
          List<PennTreebankPOS[]> labels = new ArrayList<>();
          
          load("D:\\sourceforge\\corpora\\PennTreebank\\PennTreebank2\\TAGGED\\POS\\WSJ", sentences, labels);        
          load("D:\\sourceforge\\corpora\\PennTreebank\\PennTreebank2\\TAGGED\\POS\\BROWN", sentences, labels);
          
          String[][] x = sentences.toArray(new String[sentences.size()][]);
          PennTreebankPOS[][] y = labels.toArray(new PennTreebankPOS[labels.size()][]);
          
          HMMPOSTagger tagger = HMMPOSTagger.learn(x, y);
  
          try {
              FileOutputStream fos = new FileOutputStream("hmmpostagger.model");
              ObjectOutputStream oos = new ObjectOutputStream(fos);
              oos.writeObject(tagger);
              oos.flush();
              oos.close();
          } catch (Exception ex) {
              logger.error("Failed to save HMM POS model", ex);
          }
      }
docs: Train the default model on WSJ and BROWN datasets.