public ClassifierResult[] classifyDocument(String[] document,
Datastore datastore, String defaultCategory, int numResults)
throws InvalidDatastoreException {
Collection<String> categories = datastore.getKeys("labelWeight");
PriorityQueue<ClassifierResult> pq =
new PriorityQueue<ClassifierResult>(numResults, new ByScoreLabelResultComparator());
for (String category : categories) {
double prob = documentWeight(datastore, category, document);
if (prob > 0.0) {
pq.add(new ClassifierResult(category, prob));
if (pq.size() > numResults) {