Creates an index of all the words in a document.