def sparse2full(doc, length):
 result = np.zeros(length, dtype=np.float32)
 doc = dict(doc)
 result[list(doc)] = list(itervalues(doc))
 return result

def sparse2full ( doc , length ) : result = np . zeros ( length , dtype = np . float32 ) doc = dict ( doc ) result [ list ( doc ) ] = list ( itervalues ( doc ) ) return result
convert a document in sparse document format into a dense np array .