Skip to content
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

Add word frequency counter feature #628

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

intbizoil
Copy link

Pull Request Title

Add Word Frequency Counter Feature

Pull Request Description

What Changed

  • Created a new Python script, word_counter.py, which counts the frequency of each word in a given text file.

Why This Is Useful

  • Allows users to quickly analyse text files for word usage.
  • Simplifies text analysis tasks for anyone working with large amounts of textual data in the repository.

How It Works

  1. word_counter.py reads the file specified via command-line argument.
  2. Converts all words to lowercase and splits them on whitespace.
  3. Uses collections.Counter to count occurrences and sorts them in descending order.
  4. Prints the results to the console.

Testing

  • Created a sample file sample.txt with the content:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant