def GetWordIds(text, vocab, pad_len=None, pad_id=None):
 ids = []
 for w in text.split():
  i = vocab.WordToId(w)
  if (i >= 0):
   ids.append(i)
  else:
   ids.append(vocab.WordToId(UNKNOWN_TOKEN))
 if (pad_len is not None):
  return Pad(ids, pad_id, pad_len)
 return ids

def GetWordIds ( text , vocab , pad_len = None , pad_id = None ) : ids = [ ] for w in text . split ( ) : i = vocab . WordToId ( w ) if ( i >= 0 ) : ids . append ( i ) else : ids . append ( vocab . WordToId ( UNKNOWN_TOKEN ) ) if ( pad_len is not None ) : return Pad ( ids , pad_id , pad_len ) return ids
get ids corresponding to words in text .