Beispiel #1
0
 def idxs2str(indices):
   """"""
   
   shape = Configurable.tupleshape(indices)
   if len(shape) == 2:
     return ' '.join(':'.join(str(subidx) for subidx in index) if index[0] == Vocab.UNK else str(index[0]) for index in indices)
   elif len(shape) == 1:
     return ' '.join(str(index) for index in indices)
   elif len(shape) == 0:
     return ''
   else:
     raise ValueError('Indices should have len(shape) 1 or 2, not %d' % len(shape))
   return