Added documentation and optimized code for sentiment_analyzer.py