

def category_words():
    '\n\t\treturn an iteration of tuples of category and list of all words in instances of that category.\n\t\tUsed if we are scoring the words for correlation to categories for feature selection (i.e.,\n\t\tscore_fn and max_feats are set)\n\t\t'
    cat_words = defaultdict([])
    for (words, cats) in train_instances:
        if isinstance(cats, collections.Iterable):
            for cat in cats:
                cat_words[cat].extend(words)
        else:
            cat_words[cats].extend(words)
    return iteritems(cat_words)

dataset/ETHPy150Open japerk/nltk-trainer/train_classifier.py category_words/original