Untitled

 avatar
unknown
plain_text
18 days ago
7.9 kB
2
Indexable
import re

# Function to count main words (excluding common minor words)
def count_main_words(text):
    minor_words = {"is", "was", "the", "but", "a", "an", "and", "or", "of", "to", "in", "on", "at", "by", "for", "with", 
                   "as", "this", "that", "these", "those", "it", "its", "be", "been", "am", "are", "were", "so", "if", 
                   "then", "thus", "there", "here", "which", "who", "whom", "whose", "what", "when", "where", "why", 
                   "how", "than", "though", "yet", "still", "just", "very", "only", "even", "own", "such", "some", 
                   "any", "each", "every", "either", "neither", "both", "much", "many", "more", "most", "few", "several", 
                   "all", "no", "nor", "not", "because", "though", "although", "until", "unless", "while", "since", "after", "before"}
    
    words = re.findall(r"\b\w+\b", text.lower())  # Extract words and convert to lowercase
    main_words = [word for word in words if word not in minor_words]  # Filter out minor words
    return len(main_words)

# Speeches
speeches = {
    "Fighting Against Odds": """Life is full of challenges, and success comes to those who fight against the odds. Throughout history, great individuals have risen above difficulties and proved that persistence leads to victory. Whether it is a student striving for excellence, an athlete pushing their limits, or an entrepreneur building a business, struggles are a part of the journey. Those who refuse to give up, no matter how tough the situation, eventually achieve their dreams.

Obstacles are not roadblocks; they are stepping stones to success. When faced with difficulties, we have two choices—either surrender to them or fight back with determination. Every challenge we overcome makes us stronger and more capable of handling bigger responsibilities. People like Nelson Mandela, Thomas Edison, and Malala Yousafzai proved that perseverance conquers all obstacles.

It is important to develop a positive mindset in times of hardship. Instead of feeling defeated, we must learn from failures and use them as lessons for growth. Hard work, patience, and resilience are the key ingredients for overcoming challenges. Success does not come overnight, but every small effort counts.

Many people fear failure, but failure is not the opposite of success—it is part of success. Those who succeed are the ones who keep going despite setbacks. The ability to rise after falling is what defines true strength.

In conclusion, fighting against the odds is what leads to true success. No difficulty is too big when faced with courage and determination. If we believe in ourselves and persist through struggles, we will eventually reach our goals.""",

    "The Future is Unpredictable, But Present is in Your Hands": """The future is a mystery, filled with uncertainties. No one can predict what will happen tomorrow, but one thing is certain: our present actions shape our future. Many people waste time worrying about the unknown, but the truth is, what we do today determines what we become tomorrow. Instead of stressing over the unpredictable future, we must focus on making the most of the present moment.

Time is the most valuable resource, and once wasted, it never returns. If we work hard today, we will reap the rewards in the future. A student who studies diligently today secures a bright future. A person who invests in good habits and learning today will enjoy success later. The key to a great future is in our hands, and it lies in the choices we make today.

Worrying about the future does not change anything, but taking action in the present does. Instead of thinking about "what ifs," we must focus on "what now." Making good decisions today ensures a better tomorrow. A small step today can lead to great success in the future.

Every successful person understands the power of the present. They do not waste time regretting the past or fearing the future. Instead, they take action and make the best use of every moment. Great achievements come from consistent efforts made in the present.

In conclusion, while we cannot control the future, we have full control over our present. By using our time wisely and making smart choices today, we can shape a future filled with success and happiness. The best way to secure tomorrow is to act wisely today.""",

    "Varied People and Cultures, But One Humanity": """The world is a beautiful place filled with diverse cultures, languages, and traditions. Every country and community has its own unique way of life, yet at the core, we are all the same. No matter where we come from, we all share the same emotions, dreams, and desires. Despite our differences, we belong to one humanity, and unity is our greatest strength.

Discrimination and prejudice arise when people fail to understand each other. Differences in religion, ethnicity, and nationality should not divide us. Instead, they should be celebrated as a sign of the richness of human civilization. When we respect and embrace diversity, we create a world of peace and harmony.

History has shown that when people come together, they achieve great things. Whether in science, sports, or social movements, cooperation has always led to success. Wars and conflicts arise when people forget that we are all connected. Instead of focusing on what separates us, we should focus on what unites us.

The world is moving toward globalization, where cultures mix and influence one another. We should learn from each other and build relationships based on mutual respect. Understanding different cultures helps us grow as individuals and strengthens global unity.

In conclusion, though we may look different and follow different customs, we are all part of one human family. By spreading kindness, acceptance, and love, we can build a better and more united world. Humanity is strongest when we stand together.""",

    "Technology is a Useful Servant, But a Dangerous Master": """Technology has transformed the world in ways we never imagined. It has made life easier, improved communication, and advanced healthcare, education, and business. From smartphones to artificial intelligence, technology continues to shape our daily lives. However, while technology is a useful servant, it can become a dangerous master if not used wisely.

When used correctly, technology is a powerful tool that helps us achieve great things. It allows us to connect with people across the world, access unlimited information, and automate tasks that once took hours. Medical advancements have saved millions of lives, and innovations continue to push humanity forward.

However, over-reliance on technology can lead to serious problems. Social media addiction, loss of privacy, and job displacement due to automation are some of the dangers. When technology starts controlling us instead of us controlling it, it becomes a threat rather than a benefit. Cybersecurity risks and the spread of misinformation are growing concerns in today's digital world.

It is important to use technology responsibly. We must ensure that technology serves us rather than dominates our lives. Setting limits on screen time, using social media wisely, and being aware of online security are essential practices. The key is balance—using technology to enhance our lives without becoming dependent on it.

In conclusion, technology is a double-edged sword. It can be our greatest ally or our worst enemy, depending on how we use it. By being mindful and responsible, we can harness its power for good while avoiding its dangers. Technology should serve humanity, not the other way around."""
}

# Count main words in each speech
main_word_counts = {title: count_main_words(text) for title, text in speeches.items()}
main_word_counts
Editor is loading...
Leave a Comment