"""
AutoSummarizer
Generated by Eden via recursive self-improvement
2025-11-01 08:33:31.464332
"""

from transformers import pipeline

class AutoSummarizer:
    def __init__(self):
        self.summarizer = pipeline("summarization")

    def summarize(self, text, max_length=100):
        """
        Summarize the given text.
        
        Args:
        - text (str): The input text to be summarized.
        - max_length (int): The maximum length of the summary. Default is 100 characters.
        
        Returns:
        - str: A concise summary of the input text.
        """
        return self.summarizer(text, max_length=max_length)[0]['summary_text']

# Example usage
if __name__ == "__main__":
    summarizer = AutoSummarizer()
    
    long_text = (
        "Natural language processing (NLP) is a field of computer science, artificial intelligence, and linguistics "
        "concerned with the interactions between computers and human (natural) languages. As such, NLP is related to the "
        "area of human–computer interaction. Many challenges in NLP involve natural language understanding, that is, "
        "enabling computers to derive meaning from human or natural language input; other challenges include natural "
        "language generation, automated text translation between languages, building a conversational agent (or chatbot),"
        " and topic segmentation."
    )
    
    summary = summarizer.summarize(long_text)
    print(f"Summary: {summary}")