Skip to main content

Product generator

Project description

product generator

PRoduct (1)

Install

pip install productgen

Key Modules & Features

AIProductGenerator

  • generative_creative_names(category, brand, num_suggestions)
    Generates creative product name suggestions by leveraging a language model (e.g. GPT-2).
  • generate_product_story(product_name)
    Produces a short, compelling story or description for the given product.

Generator Module

  • generate_product_name
    Combines category, subcategory, brand, and style (e.g. hyphenation, title casing) to form product names.
  • generate_marketing_taglines
    Returns sample taglines for marketing, incorporating style or suffix.

Analyzer (ProductNameAnalyzer)

  • analyze_sentiment
    Calculates sentiment and subjectivity for a given product name.
  • suggest_improvements
    Provides suggestions for improvement if the sentiment score or memorability is low.

ProductGenConfig

  • load_config / save_config
    Loads and saves configuration (e.g., custom brands) to a JSON file.
  • add_custom_brand
    Adds a custom brand entry to the config, avoiding duplicates.

How To Usage ?

Example 1

# file: example_usage.py
from productgen.generator import generate_product_name, Style

def main():
    product_1 = generate_product_name(Style.SIMPLE_CONCAT)
    print("Contoh nama produk:", product_1)

    product_2 = generate_product_name(Style.TITLE_CASE, brand="MyBrand", use_suffix=True, use_tagline=True)
    print("Contoh nama produk dengan brand, suffix, dan tagline:", product_2)

if __name__ == "__main__":
    main()

Run it:

python example.py

Example 2

# file: running.py
from productgen.ai_generator import AIProductGenerator
from productgen.generator import Style
from rich.console import Console
from rich.panel import Panel
from rich.table import Table

def format_names(names):
    return names

def main():
    console = Console()
    generator = AIProductGenerator()

    console.print("[bold blue]Product Name Generator[/bold blue]")
    console.print("=" * 50)

    # Generate creative names
    names = generator.generative_creative_names(
        category="smartphone",
        brand="JojoPhone",
        style=Style.TITLE_CASE,
    )

    # Display in a table
    name_table = Table(title="Generated Product Names")
    name_table.add_column("No.", style="cyan")
    name_table.add_column("Name", style="green")
    
    for idx, name in enumerate(format_names(names), 1):
        name_table.add_row(str(idx), name)
    console.print(name_table)

    # Generate product story
    story = generator.generate_product_story("JojoPhone UltraPhone")
    console.print(Panel(story, title="Product Story", border_style="blue"))

    # Generate features
    features = generator.generate_product_features("JojoPhone UltraPhone", "smartphone")
    feature_table = Table(title="Product Features")
    feature_table.add_column("No.", style="cyan")
    feature_table.add_column("Feature", style="green")
    for i, f in enumerate(features, 1):
        feature_table.add_row(str(i), f)
    console.print(feature_table)

    # Analyze the name
    analysis = generator.analyze_name_effectiveness("JojoPhone UltraPhone")
    analysis_table = Table(title="Name Analysis")
    analysis_table.add_column("Metric", style="cyan")
    analysis_table.add_column("Score", style="green")
    for metric, score in analysis.items():
        analysis_table.add_row(metric, f"{score:.2f}")
    console.print(analysis_table)

    # Batch generate names
    categories = ["smartphone", "laptop", "tablet"]
    batch_result = generator.batch_generate_names(categories, brand="JojoPhone")
    console.print("[bold blue]Batch Generated Names[/bold blue]")
    for category, generated_names in batch_result.items():
        cat_table = Table(title=f"{category.title()} Names")
        cat_table.add_column("No.", style="cyan")
        cat_table.add_column("Name", style="green")
        for idx, nm in enumerate(format_names(generated_names), 1):
            cat_table.add_row(str(idx), nm)
        console.print(cat_table)
        console.print("")

if __name__ == "__main__":
    main()

Run it:

python running.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

productgen-0.0.8.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

productgen-0.0.8-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file productgen-0.0.8.tar.gz.

File metadata

  • Download URL: productgen-0.0.8.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for productgen-0.0.8.tar.gz
Algorithm Hash digest
SHA256 6f9d1ff1817ce67fb246e81ba1f3323554e7379498150d597fc21f2170576294
MD5 76734541fe44c65efa406a75986e2de8
BLAKE2b-256 d508387d74b99778c60eed26739bf922fa154512322a16b1c12718a5d6fd8c93

See more details on using hashes here.

File details

Details for the file productgen-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: productgen-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for productgen-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 507e3a0756ac0feb79f0b9e6c06f3029d47a264859f5b8dfe80e43eab068bdce
MD5 5d6207ac9d52631c4a5263510ab8ecd5
BLAKE2b-256 af30a6c2e9a7bc8f0c7b494dd09b2626cfe85a99f8de01cae5f72346fc614de4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page