BagOfWordsFeatureGenerator bowfg
= new BagOfWordsFeatureGenerator();
DoccatModel model = DocumentCategorizerME.train("en",
ds, cutoff, iterations, nffg, bowfg); //<co id="tm.train"/>
model.serialize(new FileOutputStream(modelFile));
/*<calloutlist>
<callout arearefs="tm.tok">Create data stream</callout>
<callout arearefs="tm.fg">Set up features generators</callout>
<callout arearefs="tm.train">Train categorizer</callout>