Creates a word index for a text collection.