Converted code to Python 3, now that NLTK is no longer a dependency.