diff --git a/Number-Guess/TextAnalyzer/README.md b/Number-Guess/TextAnalyzer/README.md new file mode 100644 index 0000000..138dde4 --- /dev/null +++ b/Number-Guess/TextAnalyzer/README.md @@ -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! \ No newline at end of file diff --git a/Number-Guess/TextAnalyzer/Text.py b/Number-Guess/TextAnalyzer/Text.py new file mode 100644 index 0000000..6095274 --- /dev/null +++ b/Number-Guess/TextAnalyzer/Text.py @@ -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()