Skip to content

Latest commit

 

History

History
71 lines (57 loc) · 1.92 KB

File metadata and controls

71 lines (57 loc) · 1.92 KB

Word Cloud Generator for Text Analysis

Project Description

This Python script generates word clouds from text files, allowing users to visualize the most frequent words in a document. The project uses natural language processing techniques to preprocess text and create visually appealing word cloud visualizations.

Features

  • Text preprocessing (lowercase conversion, stopword removal)
  • Word cloud generation with customizable appearance
  • Support for custom background masks
  • Visualization using Matplotlib

Example 🖼️

  • Wordcloud: Wordcloud Image
  • Customized WordCloud: Customized WordCloud Image

Prerequisites

Before running the script, ensure you have the following installed:

  • Python 3.7+
  • pip (Python package manager)

Installation

  1. Clone the repository:
git clone https://github.com/YourUsername/word-cloud-generator.git
cd word-cloud-generator
  1. Install required dependencies:
pip install matplotlib numpy wordcloud nltk pillow
  1. Download NLTK resources:
python -c "import nltk; nltk.download('stopwords'); nltk.download('punkt')"

Usage

  1. Prepare your text file (ensure UTF-8 encoding)

  2. Modify the script to specify your text file path:

    • Replace /content/text.txt with the path to your text file
    • Customize word cloud parameters as needed
  3. Run the script:

python word_cloud_generator.py

Customization Options

  • Change background color
  • Modify color scheme (colormap)
  • Use a custom mask image for word cloud shape
  • Adjust text preprocessing settings

Dependencies

  • matplotlib
  • numpy
  • wordcloud
  • nltk
  • pillow

Customization

You can customize the word cloud by modifying parameters such as:

  • background_color: Change the background color
  • colormap: Adjust the color scheme
  • contour_color: Set the outline color
  • mask: Use a custom shape for the word cloud