Generate a word via a mask and an index