System.out.println(getHelp());
} else {
DoccatModel model = new DoccatModelLoader().load(new File(args[0]));
DocumentCategorizerME doccat = new DocumentCategorizerME(model);
/**
* moved initialization to the try block to catch new IOException
*/
ObjectStream<String> documentStream;
PerformanceMonitor perfMon = new PerformanceMonitor(System.err, "doc");
perfMon.start();
try {
documentStream = new ParagraphStream(
new PlainTextByLineStream(new SystemInputStreamFactory(), SystemInputStreamFactory.encoding()));
String document;
while ((document = documentStream.read()) != null) {
String[] tokens = model.getFactory().getTokenizer().tokenize(document);
double prob[] = doccat.categorize(tokens);
String category = doccat.getBestCategory(prob);
DocumentSample sample = new DocumentSample(category, tokens);
System.out.println(sample.toString());
perfMon.incrementCounter();