Skip to content

Commit 021daf6

Browse files
authored
PR #43: Text Analyzer Project
Added Text Analyzer mini project Merge pull request #43 from sheylaghost/text-analyzer
2 parents 55eb126 + 7474507 commit 021daf6

File tree

2 files changed

+122
-0
lines changed

2 files changed

+122
-0
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
🧠 Text Analyzer — Python Project
2+
3+
A simple and efficient text analyzer in Python that calculates basic statistics from user-provided text, such as total words, characters, and the most frequently used word.
4+
5+
6+
---
7+
8+
🚀 Features
9+
10+
Counts the total number of words
11+
12+
Counts total characters, both with and without spaces
13+
14+
Identifies the most used word in the text
15+
16+
Displays results clearly in the terminal
17+
18+
19+
20+
---
21+
22+
🧩 Technologies Used
23+
24+
Python 3
25+
26+
Standard library collections (Counter)
27+
28+
29+
30+
---
31+
32+
📦 Installation
33+
34+
1. Clone this repository:
35+
36+
git clone https://github.com/sheylaghost/text-analyzer.git
37+
38+
39+
2. Navigate to the project directory:
40+
41+
cd text-analyzer
42+
43+
44+
3. Run the script:
45+
46+
python main.py
47+
48+
49+
50+
51+
---
52+
53+
🧠 How to Use
54+
55+
1. Run the program in your terminal.
56+
57+
58+
2. Enter or paste any text when prompted.
59+
60+
61+
3. View the automatically generated analysis.
62+
63+
64+
65+
Example:
66+
67+
🧠 Text Analyzer — Python Project
68+
Enter or paste the text you want to analyze:
69+
70+
Python is amazing. Python is powerful.
71+
72+
📊 Text Analysis Results:
73+
➡️ Total words: 5
74+
➡️ Total characters (with spaces): 39
75+
➡️ Total characters (without spaces): 34
76+
➡️ Most used word: 'Python' (2x)
77+
78+
79+
---
80+
81+
💡 Possible Future Improvements
82+
83+
Make the word count case-insensitive
84+
85+
Remove punctuation before counting
86+
87+
Calculate the number of unique words
88+
89+
Export results to a .txt or .json file
90+
91+
92+
93+
---
94+
95+
🧑‍💻 Author
96+
97+
Eyshila Ivanha de Brito
98+
Created as a Python learning exercise and open-source contribution.
99+
💬 Feel free to open issues or suggest improvements!

Number-Guess/TextAnalyzer/Text.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from collections import Counter
2+
3+
def analyze_text(text):
4+
words = text.split()
5+
total_words = len(words)
6+
total_chars = len(text)
7+
total_no_spaces = len(text.replace(" ", ""))
8+
9+
most_common_word = Counter(words).most_common(1)[0]
10+
11+
print("\n📊 Text Analysis Results:")
12+
print(f"➡️ Total words: {total_words}")
13+
print(f"➡️ Total characters (with spaces): {total_chars}")
14+
print(f"➡️ Total characters (without spaces): {total_no_spaces}")
15+
print(f"➡️ Most used word: '{most_common_word[0]}' ({most_common_word[1]}x)")
16+
17+
def main():
18+
print("🧠 Text Analyzer — Python Project")
19+
text = input("Enter or paste the text you want to analyze:\n\n")
20+
analyze_text(text)
21+
22+
if __name__ == "__main__":
23+
main()

0 commit comments

Comments
 (0)