Video demo: click here
Welcome to the Word Frequency Analyzer and Visualization project repository! This Python Flask-based web application is designed to analyze word frequency in a given text and visually represent the most common words with module creation inheriting the concept of Object-Oriented-Programming in python. This README provides a comprehensive guide to understand, set up, and utilize this project effectively. The Word Frequency Analyzer and Visualization is a Python program designed to analyze the frequency of words in a given text or a set of texts. This tool is perfect for anyone interested in understanding the distribution of words within a passage and visualizing the most commonly used words.
The Word Frequency Analyzer and Visualization project is an interactive web application developed using Python, Flask, Jinja, HTML, CSS, Bootstrap, SQLite3, Matplotlib, and NLTK. It allows users to input text, analyze word frequency, and visualize the most common words through a user-friendly interface.
-
static: Contains static files, including:
styles.css
: CSS styles for the project.barchart.png
: The saved file from the main Python app.- Logo icon.
-
templates: Contains HTML files:
index.html
: Homepage for text input.analyzed.html
: Display page after Python processing.error.html
: Error page for handling analysis issues.
word_frequency.py
: Contains theWordFrequency
class for text analysis and visualization.app.py
: (Flask) Main application script for routing, data manipulation, and uses WordFrequency class to analyze and visualize data.test_WordFrequency.py
: Python testing for the WordFrequency.pyfrequency.db
: Database which contains two tablestext
- stores input text of users andvisits
- stores button click and download counts.
-
Setup:
- Ensure necessary dependencies are installed (
nltk
,matplotlib
,cs50
,pytest
). - Run
pip install nltk matplotlib cs50 pytest
to install missing libraries. - Run
python -m nltk.downloader stopwords punkt
- Run
pytest test_WordFrequency.py
to test WordFrequency class from the module.
- Ensure necessary dependencies are installed (
-
Start the Flask App:
- Run
flask run
in your terminal. - Access the application at
http://localhost:5000/
.
- Run
-
Usage:
- Enter text in the provided field on the homepage.
- Click the "Analyze" button to process the text and view word frequencies.
- Click "Download" to download the PNG file of your word analysis
- Python
- Flask
- Jinja
- HTML
- CSS
- Bootstrap
- SQLite3
- Matplotlib
- NLTK
- Pytest
- CS50
Contributions are welcome! Feel free to submit issues or pull requests to enhance the project.