def prep_data(raw_input, input_type, max_len, vocab, dtype='int32', index_from=2, oov=1):
 dtype = np.dtype(dtype)
 if (input_type == 'text'):
  in_shape = (max_len, 1)
  tokens = tokenize(raw_input)
  sent_inp = np.array([(oov if (t not in vocab) else (vocab[t] + index_from)) for t in tokens])
  l = min(len(sent_inp), max_len)
  xbuf = np.zeros(in_shape, dtype=dtype)
  xbuf[(- l):] = sent_inp[(- l):].reshape((-1), 1)
  return xbuf
 else:
  raise ValueError(('Unsupported data type: %s' % input_type))

def prep_data ( raw_input , input_type , max_len , vocab , dtype = 'int32' , index_from = 2 , oov = 1 ) : dtype = np . dtype ( dtype ) if ( input_type == 'text' ) : in_shape = ( max_len , 1 ) tokens = tokenize ( raw_input ) sent_inp = np . array ( [ ( oov if ( t not in vocab ) else ( vocab [ t ] + index_from ) ) for t in tokens ] ) l = min ( len ( sent_inp ) , max_len ) xbuf = np . zeros ( in_shape , dtype = dtype ) xbuf [ ( - l ) : ] = sent_inp [ ( - l ) : ] . reshape ( ( - 1 ) , 1 ) return xbuf else : raise ValueError ( ( 'Unsupported data type: %s' % input_type ) )
transforms the raw received input data to put it in the required format for running through neon .