Skip to content

Arhosseini77/word_sentence_cloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sentence and Word Cloud image generator

This repository provides a Python script for generating word clouds from a list of Persian slogans. The slogans used as an example in this project were generated by ChatGPT. You can select from several different color themes to customize the appearance of your word cloud.

Word Cloud Example

Features

  • Predefined Color Themes: Choose from various themes to style the word cloud.
  • Customizable Font: Change the font to support different languages or styles.
  • Easy-to-Use: Simply provide a list of Sentences/word.

Installation

  1. Clone the repository:

  2. Install the required Python packages:

    pip install wordcloud matplotlib

Usage

  1. Replace the slogans list with your own slogans in the slogans variable.

  2. Call the generate_slogan_wordcloud_with_theme function with:

    • slogans: A list of slogan strings.
    • output_path: Path to save the word cloud image.
    • theme_index: Index ranging from 0 to 7 representing different color themes.
  3. Example usage:

    slogans = [
        'حفظ آسایش دهان با خمیردندان حاوی فلوراید',
        'سفید کننده دندان برای اطمینان شما',
        'خمیردندان با فلوراید برای احتیاط دندان',
        'سادگی و آسایش با خمیردندان حاوی فلوراید',
        # Add more slogans as needed
    ]
    
    output_path = 'wordcloud_slogans_with_theme.png'
    theme_index = 0  # Choose the desired theme index (0 to 7)
    generate_slogan_wordcloud_with_theme(slogans, output_path, theme_index)
  4. Note: The example slogans provided above were generated by ChatGPT as a demonstration of the word cloud functionality. Feel free to replace them with your own custom slogans.

Color Themes

Each theme is represented by an index (0 to 7). The themes available are:

  • 0: Yellow, Brown, Orange
  • 1: Green, Light Green, Dark Green
  • 2: Gray, Black, Dark Blue Gray
  • 3: Red, Light Red, Crimson
  • 4: Brown, Burnt Brown, Light Brown
  • 5: Pink, Rose, Peach
  • 6: Light Blue, Blue, Light Purple
  • 7: Dark Blue, Purple

Multilingual Support

This code supports word clouds in any language. Simply provide your slogans in the language of your choice and ensure that a suitable font is specified.

About

Sentence and Word Cloud Image Generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages