def basic_extractor(document, train_set):
 word_features = _get_words_from_dataset(train_set)
 tokens = _get_document_tokens(document)
 features = dict(((u'contains({0})'.format(word), (word in tokens)) for word in word_features))
 return features

def basic_extractor ( document , train_set ) : word_features = _get_words_from_dataset ( train_set ) tokens = _get_document_tokens ( document ) features = dict ( ( ( u'contains({0})' . format ( word ) , ( word in tokens ) ) for word in word_features ) ) return features
a basic document feature extractor that returns a dict indicating what words in train_set are contained in document .