Updated text analysis script