Skip to content

A Python library for generating random texts, sentences, paragraphs, comments, and names in multiple languages like English, Spanish, French, and German.

License

Notifications You must be signed in to change notification settings

daireto/dummy-text-generator

Repository files navigation

Dummy Text Generator

Supported Python versions Package version Publish Coverage Status License

A Python library for generating random texts, sentences, paragraphs, comments, and names in multiple languages like English, Spanish, French, and German.

The generated content is assembled using predefined templates and words. It does not use any machine learning models or external APIs. It is intended for generating dummy content for testing and development purposes.

Table of Contents

Features

  • Generate random sentences with customizable topics
  • Create paragraphs with multiple sentences
  • Generate engaging comments about specific topics
  • Create random full names based on language/region
  • Generate usernames from full names
  • Generate email addresses from usernames
  • Support for multiple languages:
    • English (en)
    • Spanish (es)
    • French (fr)
    • German (de)

Installation

pip install dummy-text-generator

Usage

Basic Examples

from dummy_text_generator import (
    generate_comment,
    generate_email_from_username,
    generate_fullname,
    generate_paragraph,
    generate_sentence,
    generate_username_from_fullname,
)

# Generate a random sentence in English
sentence = generate_sentence(lang='en')
# Output: "Today I was thinking about how amazing it is to learn something new about technology and discovered something surprising."

# Generate a sentence about a specific topic with a hashtag
sentence = generate_sentence(lang='es', topic='los deportes', add_hashtag=True)
# Output: "Hoy estuve pensando en lo increíble que es aprender algo nuevo sobre deportes y descubrí algo sorprendente. #Increible"

# Generate a paragraph with multiple sentences
paragraph = generate_paragraph(lang='en', sentences=3)
# Output: Multiple sentences about random topics

# Generate a comment about a specific topic
comment = generate_comment(lang='fr', topic='la technologie')
# Output: "J'aime tout ce qui concerne technologie. Il y a toujours quelque chose nouveau à découvrir !"

# Generate a random full name
name = generate_fullname(lang='de')
# Output: "Franziska Schneider"

# Generate a username from a full name
username = generate_username_from_fullname("John Miller")
# Output: "johnmill28"

# Generate an email from a username
email = generate_email_from_username("johnmill28")
# Output: "[email protected]"

Note

It is recommended to add the article before the topic, for example, "the sports" instead of "sports".

Available Languages

  • en: English
  • es: Spanish
  • fr: French
  • de: German

Available Topics

The library includes a wide range of topics such as:

  • Technology
  • Travel
  • Cooking
  • Sports
  • Music
  • Science
  • Fashion
  • Art
  • And many more...

API Reference

generate_sentence(lang='en', topic=None, add_hashtag=False)

Generates a random sentence.

  • lang: Language code (default: 'en')
  • topic: Specific topic (optional)
  • add_hashtag: Add a random hashtag at the end (default: False)

generate_paragraph(lang='en', sentences=3, topic=None)

Generates a random paragraph.

  • lang: Language code (default: 'en')
  • sentences: Number of sentences (default: 3)
  • topic: Specific topic (optional)

generate_comment(lang='en', topic=None)

Generates a random comment about a topic.

  • lang: Language code (default: 'en')
  • topic: Specific topic (optional)

generate_fullname(lang='en')

Generates a random full name based on the specified language/region.

  • lang: Language code (default: 'en')

generate_username_from_fullname(fullname)

Generates a username from a given full name.

  • fullname: Full name string

generate_email_from_username(username)

Generates an email address from a username.

  • username: Username string

Error Handling

The library raises KeyError when an unsupported language code is provided.

Contributing

Contributions are welcome! Feel free to:

  • Add support for new languages.
  • Expand or modify the existing vocabulary.
  • Improve generation algorithms.
  • Fix bugs or suggest improvements.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support

If you find this project useful, give it a ⭐ on GitHub!

About

A Python library for generating random texts, sentences, paragraphs, comments, and names in multiple languages like English, Spanish, French, and German.

Topics

Resources

License

Stars

Watchers

Forks

Languages