def make_idx_data_cv(revs, word_idx_map, cv, max_l=51, k=300, filter_h=5):
 (train, test) = ([], [])
 for rev in revs:
  sent = get_idx_from_sent(rev['text'], word_idx_map, max_l, k, filter_h)
  sent.append(rev['y'])
  if (rev['split'] == cv):
   test.append(sent)
  else:
   train.append(sent)
 train = np.array(train, dtype='int')
 test = np.array(test, dtype='int')
 return [train, test]

def make_idx_data_cv ( revs , word_idx_map , cv , max_l = 51 , k = 300 , filter_h = 5 ) : ( train , test ) = ( [ ] , [ ] ) for rev in revs : sent = get_idx_from_sent ( rev [ 'text' ] , word_idx_map , max_l , k , filter_h ) sent . append ( rev [ 'y' ] ) if ( rev [ 'split' ] == cv ) : test . append ( sent ) else : train . append ( sent ) train = np . array ( train , dtype = 'int' ) test = np . array ( test , dtype = 'int' ) return [ train , test ]
transforms sentences into a 2-d matrix .