How can I create one hot encoding of words with each word represented by a sparse vector of vocab size and the index of that particular word equated to 1 , using tensorflow ?
something like
oneHotEncoding(words = ['a','b','c','d']) -> [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]] ?
Scikits one hot encoder takes an int-array (http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html). Building on your example you could us a dictionary to map words to integers and go from there:
which yields