This project is a Python script that counts the frequency of words in a text and shows the top 10 most frequent words in a bar chart.
To run this project, you need to have Python 3 and the following libraries installed:
- Regular expressions
- Collections
- Matplotlib You can install them using pip: bash
pip install re collections matplotlib
Then, you need to have a text file named “text.txt” in the same folder as the script. You can change the name of the file or the path in the code if you want. To run the script, simply execute:
python word_frequency.py
You should see a figure with a bar chart showing the top 10 most frequent words and their counts. Sources This project is based on the following sources: How to Count Word Frequency in Python Python Collections Module Matplotlib Tutorial: Learn basics of Python’s powerful Plotting library