product generator
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
Metadata
Release files for productgen 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| productgen-0.0.8.tar.gz | 15.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| productgen-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.6 kB
Release files / productgen-0.0.8.tar.gz
| Download URL | productgen-0.0.8.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f9d1ff1817ce67fb246e81ba1f3323554e7379498150d597fc21f2170576294
|
|
BLAKE2b-256 checksum How to use checksums |
d508387d74b99778c60eed26739bf922fa154512322a16b1c12718a5d6fd8c93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.6
|
Release files / productgen-0.0.8-py3-none-any.whl
| Download URL | productgen-0.0.8-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
507e3a0756ac0feb79f0b9e6c06f3029d47a264859f5b8dfe80e43eab068bdce
|
|
BLAKE2b-256 checksum How to use checksums |
af30a6c2e9a7bc8f0c7b494dd09b2626cfe85a99f8de01cae5f72346fc614de4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.6
|