def prepare_labels(labels):
 d = {}
 count = 0
 setlabels = set(labels)
 for w in setlabels:
  d[w] = count
  count += 1
 idxlabels = np.array([d[w] for w in labels])
 return idxlabels

def prepare_labels ( labels ) : d = { } count = 0 setlabels = set ( labels ) for w in setlabels : d [ w ] = count count += 1 idxlabels = np . array ( [ d [ w ] for w in labels ] ) return idxlabels
process labels to numerical values .