

def extract_features(label_instances, featx):
    if isinstance(label_instances, dict):
        feats = []
        for (label, instances) in iteritems(label_instances):
            feats.extend([(featx(i), label) for i in instances])
    else:
        feats = [(featx(i), label) for (i, label) in label_instances]
    return feats

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