def test_main(self): tdm = build_hamlet_jz_corpus_with_meta() features = FeatureLister(tdm._mX, tdm._metadata_idx_store, tdm.get_num_docs()).output() self.assertEqual(features, [{ 'cat4': 2, 'cat3': 1 }, { 'cat4': 2 }, { 'cat5': 1, 'cat3': 2 }, { 'cat6': 2, 'cat9': 1 }, { 'cat4': 2, 'cat3': 1 }, { 'cat2': 1, 'cat1': 2 }, { 'cat2': 2, 'cat5': 1 }, { 'cat4': 1, 'cat3': 2 }])
def list_extra_features(self): ''' Returns ------- List of dicts. One dict for each document, keys are metadata, values are counts ''' return FeatureLister(self._mX, self._metadata_idx_store, self.get_num_docs()).output()