"""
SentimentIntensityAnalyzerEnhanced
Generated by Eden via recursive self-improvement
2025-10-31 22:26:44.440329
"""

from textblob import TextBlob

class SentimentIntensityAnalyzerEnhanced:
    def __init__(self):
        self.sentiments = {}

    def analyze(self, text: str) -> dict:
        """
        Analyze the sentiment in the given text.
        
        Args:
            text (str): The input text to be analyzed.

        Returns:
            dict: A dictionary containing the sentiment analysis results with keys 'polarity', 
                  'subjectivity', and a new key 'sentiment_strength'.
        """
        blob = TextBlob(text)
        self.sentiments['polarity'] = blob.sentiment.polarity
        self.sentiments['subjectivity'] = blob.sentiment.subjectivity
        
        # Calculate sentiment strength based on polarity
        if -1 <= self.sentiments['polarity'] < 0:
            sentiment_strength = (abs(self.sentiments['polarity']) + 1) / 2
        elif 0 <= self.sentiments['polarity'] <= 1:
            sentiment_strength = (self.sentiments['polarity'] + 1) / 2
        else:
            sentiment_strength = 0.5  # Neutral polarity
        
        self.sentiments['sentiment_strength'] = round(sentiment_strength, 4)
        
        return self.sentiments

# Example usage
if __name__ == "__main__":
    analyzer = SentimentIntensityAnalyzerEnhanced()
    
    text1 = "I am extremely happy about this development."
    result1 = analyzer.analyze(text1)
    print(f"Text: {text1}\nSentiment Analysis: {result1}")
    
    text2 = "The weather is quite okay today."
    result2 = analyzer.analyze(text2)
    print(f"\nText: {text2}\nSentiment Analysis: {result2}")