DoccatModel model = new DoccatModelLoader().load(new File(args[0]));
DocumentCategorizerME doccat = new DocumentCategorizerME(model);
ObjectStream<String> documentStream = new ParagraphStream(
new PlainTextByLineStream(new InputStreamReader(System.in)));
PerformanceMonitor perfMon = new PerformanceMonitor(System.err, "doc");
perfMon.start();
try {
String document;
while ((document = documentStream.read()) != null) {
double prob[] = doccat.categorize(WhitespaceTokenizer.INSTANCE.tokenize(document));
String category = doccat.getBestCategory(prob);
DocumentSample sample = new DocumentSample(category, document);
System.out.println(sample.toString());