Refactored ShakespearAnalyzer class