def extract_unigram_feats(document, unigrams, handle_negation=False):
 features = {}
 if handle_negation:
  document = mark_negation(document)
 for word in unigrams:
  features['contains({0})'.format(word)] = (word in set(document))
 return features

def extract_unigram_feats ( document , unigrams , handle_negation = False ) : features = { } if handle_negation : document = mark_negation ( document ) for word in unigrams : features [ 'contains({0})' . format ( word ) ] = ( word in set ( document ) ) return features
populate a dictionary of unigram features .