Convert text to an inverted index