if (tl1 == null)
tl1 = TokenizationService.getTokenizationService().tokenize(doc1);
YKDictionary dict = yoshikoder.getDictionary();
// compute the dictionary counts
EntryFrequencyMap efm1 = new EntryFrequencyMap(catnode, tl1);
List lkeys = efm1.getSortedCategoryEntries();
Node[] keys = (Node[])lkeys.toArray(new Node[lkeys.size()]);
int[] counts = new int[keys.length+1];
for (int ii=0; ii<keys.length; ii++) {
Integer cnt = (Integer) efm1.getEntryCount(keys[ii]);
counts[ii] = cnt.intValue();
}
// add N
counts[keys.length] = efm1.getTokenTotal();
HSSFWorkbook wb = new HSSFWorkbook();
HSSFRow row;
HSSFCell cell;
HSSFSheet sheet = wb.createSheet("Category frequencies");
// header
row = sheet.createRow((short)0);
for (int c=0; c<keys.length; c++){
cell = row.createCell((short)(c+1));
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
String nodepath = efm1.getEntryPath(keys[c]);
cell.setCellValue(nodepath);
}
cell = row.createCell((short)(keys.length+1));
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue("Total");