prep utility to calc frequencies of classes and terms for a set of documents