// load classifier
TextClassifier classifier = TextClassifier
.getClassifier(new File(resourceDir));
// create a document from a String
String[] tokens = Tokenizer.tokenize(text.toString(), true);
Document doc = classifier.createDocument(tokens);
// classify
double[] scores = classifier.classify(doc);
// get best label
String label = classifier.getBestLabel(scores);
System.out.println("Classified as : " + label);