Utility functions for text analysis.