-
Notifications
You must be signed in to change notification settings - Fork 37
Added Text Analyzer mini project #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
iamwatchdogs
merged 2 commits into
Grow-with-Open-Source:main
from
sheylaghost:text-analyzer
Nov 9, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| 🧠 Text Analyzer — Python Project | ||
|
|
||
| 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. | ||
|
|
||
|
|
||
| --- | ||
|
|
||
| 🚀 Features | ||
|
|
||
| Counts the total number of words | ||
|
|
||
| Counts total characters, both with and without spaces | ||
|
|
||
| Identifies the most used word in the text | ||
|
|
||
| Displays results clearly in the terminal | ||
|
|
||
|
|
||
|
|
||
| --- | ||
|
|
||
| 🧩 Technologies Used | ||
|
|
||
| Python 3 | ||
|
|
||
| Standard library collections (Counter) | ||
|
|
||
|
|
||
|
|
||
| --- | ||
|
|
||
| 📦 Installation | ||
|
|
||
| 1. Clone this repository: | ||
|
|
||
| git clone https://github.com/sheylaghost/text-analyzer.git | ||
|
|
||
|
|
||
| 2. Navigate to the project directory: | ||
|
|
||
| cd text-analyzer | ||
|
|
||
|
|
||
| 3. Run the script: | ||
|
|
||
| python main.py | ||
|
|
||
|
|
||
|
|
||
|
|
||
| --- | ||
|
|
||
| 🧠 How to Use | ||
|
|
||
| 1. Run the program in your terminal. | ||
|
|
||
|
|
||
| 2. Enter or paste any text when prompted. | ||
|
|
||
|
|
||
| 3. View the automatically generated analysis. | ||
|
|
||
|
|
||
|
|
||
| Example: | ||
|
|
||
| 🧠 Text Analyzer — Python Project | ||
| Enter or paste the text you want to analyze: | ||
|
|
||
| Python is amazing. Python is powerful. | ||
|
|
||
| 📊 Text Analysis Results: | ||
| ➡️ Total words: 5 | ||
| ➡️ Total characters (with spaces): 39 | ||
| ➡️ Total characters (without spaces): 34 | ||
| ➡️ Most used word: 'Python' (2x) | ||
|
|
||
|
|
||
| --- | ||
|
|
||
| 💡 Possible Future Improvements | ||
|
|
||
| Make the word count case-insensitive | ||
|
|
||
| Remove punctuation before counting | ||
|
|
||
| Calculate the number of unique words | ||
|
|
||
| Export results to a .txt or .json file | ||
|
|
||
|
|
||
|
|
||
| --- | ||
|
|
||
| 🧑💻 Author | ||
|
|
||
| Eyshila Ivanha de Brito | ||
| Created as a Python learning exercise and open-source contribution. | ||
| 💬 Feel free to open issues or suggest improvements! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| from collections import Counter | ||
|
|
||
| def analyze_text(text): | ||
| words = text.split() | ||
| total_words = len(words) | ||
| total_chars = len(text) | ||
| total_no_spaces = len(text.replace(" ", "")) | ||
|
|
||
| most_common_word = Counter(words).most_common(1)[0] | ||
|
|
||
| print("\n📊 Text Analysis Results:") | ||
| print(f"➡️ Total words: {total_words}") | ||
| print(f"➡️ Total characters (with spaces): {total_chars}") | ||
| print(f"➡️ Total characters (without spaces): {total_no_spaces}") | ||
| print(f"➡️ Most used word: '{most_common_word[0]}' ({most_common_word[1]}x)") | ||
|
|
||
| def main(): | ||
| print("🧠 Text Analyzer — Python Project") | ||
| text = input("Enter or paste the text you want to analyze:\n\n") | ||
| analyze_text(text) | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.