Skip to content

A chinese lorem ipsum generator with real world word frequency.

License

Notifications You must be signed in to change notification settings

SunnyCloudYang/Chinese-lorem-ipsum

Repository files navigation

Chinese Lorem Ipsum Generator

Website chinese-lorem-ipsum.vercel.app GitHub license

Description

This project generates random text based on real world frequency table of Chinese characters. It reads character frequencies from a file and uses them to generate random sentences.

By default, it generates a random text with 3~5 paragraphs, 4~8 sentences per paragraph, and no more than 20 characters per sentence, which is about 300 characters.

Website

Chinese Lorem Ipsum Generator

Installation

Local Installation

  1. Clone the repository:

    git clone https://github.com/SunnyCloudYang/Chinese-lorem-ipsum.git
  2. Navigate to the project directory:

    cd Chinese-lorem-ipsum
  3. Set up a virtual environment:

    python -m venv venv
  4. Activate the virtual environment:

    • On Windows:

      venv\Scripts\activate
    • On macOS/Linux:

      source venv/bin/activate
  5. Install the required dependencies:

    pip install -r requirements.txt

Website Installation

  1. Clone the repository:

    git clone https://github.com/SunnyCloudYang/Chinese-lorem-ipsum.git
  2. Navigate to the project directory:

    cd Chinese-lorem-ipsum/website
  3. Install the required dependencies:

    npm install

Usage

Interactive

  1. Navigate to the website directory:

    cd Chinese-lorem-ipsum/website
  2. Run the Vercel development server:

    vercel dev
  3. Open your browser and navigate to http://localhost:3000.

  4. Click the "Generate" button to generate a random text.

Script

  1. Ensure you have the word_freq.txt file in the project directory.

  2. Run the script to generate a random text with 3~5 paragraphs and 4~8 sentences per paragraph:

    python lorem_ipsum.py

Contributing

  1. Fork the repository.

  2. Create a new branch:

    git checkout -b feature/your-feature
  3. Make your changes and commit them:

    git commit -m "Add your message"
  4. Push to the branch:

    git push origin feature/your-feature
  5. Open a pull request.

License

This project is licensed under the MIT License.

Contact

[email protected]