Skip to content

Repository files navigation

📝 Text Analyzer (Python)

PythonLicenseStatus

A simple menu-driven Text Analyzer built using Python. This project analyzes user-entered text and provides detailed statistics such as word count, character count, vowels, consonants, uppercase/lowercase letters, palindrome checking, character frequency, and more.

This project demonstrates Python fundamentals including string manipulation, dictionaries, loops, functions, and file handling while maintaining an overall O(n) time complexity.


📑 Table of Contents

  • Features
  • Technologies Used
  • Concepts Covered
  • Time Complexity
  • Space Complexity
  • Algorithm
  • Project Structure
  • How to Run
  • Screenshots
  • Example Output
  • Learning Outcomes
  • Future Improvements
  • Project Statistics
  • Author
  • License

✨ Features

  • Convert text to Uppercase
  • Convert text to Lowercase
  • Convert text to Title Case
  • Character Count
  • Word Count
  • Sentence Count
  • Digit Count
  • Vowel Count
  • Consonant Count
  • Uppercase Letter Count
  • Lowercase Letter Count
  • Space Count
  • Special Character Count
  • Reverse Text
  • Palindrome Checker
  • Find Starting Character
  • Find Ending Character
  • Character Frequency Counter
  • Longest Word Detection
  • Shortest Word Detection
  • Estimated Reading Time
  • Replace Words
  • Save Analysis Report as a Text File
  • Menu-Driven Interface

🛠️ Technologies Used

  • Python 3
  • String Methods
  • Dictionaries
  • Loops
  • Functions
  • File Handling

📚 Concepts Covered

  • String Manipulation
  • Dictionary Operations
  • Conditional Statements
  • Loops
  • Functions
  • File Handling
  • Time Complexity Analysis
  • Space Complexity Analysis
  • Menu-Driven Programming

⚡ Time Complexity

OperationTime Complexity
Character CountO(1)
Word CountO(n)
Uppercase CountO(n)
Lowercase CountO(n)
Vowel CountO(n)
Consonant CountO(n)
Digit CountO(n)
Space CountO(n)
Special Character CountO(n)
Character FrequencyO(n)
Reverse TextO(n)
Palindrome CheckO(n)
Longest WordO(n)
Shortest WordO(n)
Reading Time CalculationO(1)
Save ReportO(n)

Overall Time Complexity

The program performs multiple linear traversals of the input text for operations such as splitting words, reversing the string, palindrome checking, sentence counting, and character analysis. Since each traversal is linear, the overall time complexity remains:

Overall Time Complexity: O(n)

Where:

  • n = Number of characters in the input text

💾 Space Complexity

Data StructureSpace Complexity
Character Frequency DictionaryO(k)
Word List (split())O(w)
Reversed StringO(n)
Clean String (Palindrome Check)O(n)

Where:

  • n = Number of characters
  • w = Number of words
  • k = Number of unique characters

Overall Space Complexity

The additional memory is mainly used for:

  • Character frequency dictionary
  • Word list
  • Reversed string
  • Clean string for palindrome checking

Overall Space Complexity: O(n)


🧠 Algorithm

  1. Read the input text from the user.
  2. Split the text into words.
  3. Traverse the string to calculate:
    • Digits
    • Vowels
    • Consonants
    • Uppercase letters
    • Lowercase letters
    • Spaces
    • Special characters
    • Character frequencies
  4. Reverse the text.
  5. Check whether the text is a palindrome.
  6. Count the number of sentences.
  7. Find the longest and shortest words.
  8. Estimate reading time.
  9. Generate a formatted report.
  10. Display the report or save it as a .txt file.

📂 Project Structure

text-analyzer-python/
│
├── text_analyzer.py
├── README.md
├── LICENSE
├── .gitignore
├── sample_report.txt
│
└── screenshots/
├── menu.png
├── analysis.png
└── save-report.png

▶️ How to Run

1. Clone the Repository

git clone https://github.com/ESHRATH907/text-analyzer-python.git

2. Navigate to the Project Folder

cd text-analyzer-python

3. Run the Program

python text_analyzer.py

📸 Screenshots

Main Menu

Main Menu


Text Analysis

Text Analysis


Save Report

Save Report


📊 Example Output

====== TEXT ANALYZER ======
Character Count : 41
Word Count : 8
Sentence Count : 1
Digits : 2
Vowels : 11
Consonants : 18
Uppercase Count : 2
Lowercase Count : 27
Spaces : 7
Special Chars : 1
Palindrome : No
Reading Time : 0.04 minute(s)

🎯 Learning Outcomes

This project helped me strengthen my understanding of:

  • Python Programming
  • String Manipulation
  • Dictionaries
  • Functions
  • Loops
  • Conditional Statements
  • File Handling
  • Problem Solving
  • Menu-Driven Applications
  • Algorithm Analysis
  • Time & Space Complexity

🚀 Future Improvements

  • Export reports as CSV
  • Export reports as PDF
  • Analyze text directly from a file
  • Find the most frequent word
  • Find the most frequent character
  • Search and count specific words
  • Remove stop words
  • Display text statistics using charts
  • Build a GUI version using Tkinter
  • Package the project as a Python application

📈 Project Statistics

PropertyValue
LanguagePython
Project TypeMini Project
Programming StyleMenu-Driven
File HandlingYes
FunctionsYes
DictionariesYes
String MethodsYes
Beginner FriendlyYes
Time ComplexityO(n)
Space ComplexityO(n)

👨‍💻 Author

Eshrath Jahan


📜 License

This project is licensed under the MIT License. See the LICENSE file for more details.


⭐ If you found this project helpful, consider giving it a star on GitHub!

About

A beginner-friendly project that demonstrates Python string manipulation, dictionaries, loops, functions, and file handling.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages